Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mapping to take a path as argument #108

Closed
jodosha opened this issue Nov 28, 2014 · 2 comments
Closed

Allow mapping to take a path as argument #108

jodosha opened this issue Nov 28, 2014 · 2 comments
Assignees
Milestone

Comments

@jodosha
Copy link
Member

jodosha commented Nov 28, 2014

When we configure Lotus::Model, it would be great to make mapping to accept a path where to find the mapping definitions.

Lotus::Model.configure do
  adapter type: :memory, uri: 'memory://localhost'
  mapping 'config/mapping'
end.load!
# config/mapping.rb
collection :users do
  # ...
end

We already support this syntax in lotusrb for routes definitions.

@jodosha jodosha added this to the v0.2.0 milestone Nov 28, 2014
@runlevel5
Copy link
Member

@jodosha I find this feature duplicated with mapping DSL in lotusrb. Are you sure on this?

@jodosha
Copy link
Member Author

jodosha commented Dec 3, 2014

@joneslee85 Sorry for the late reply. Yes I'm sure ;)

In the "container" architecture we have:

# ...
apps/
  backend/
  web/
lib/
  bookshelf.rb
  entities/
  repositories/
  interactors/

That lib/ directory implements the application use cases, independently from the delivery mechanism (aka the web apps under apps/). While the Lotus slices use something like this:

module Web
  class Application < Lotus::Application
    configure do
      mapping # path or block
    end
  end
end

The lib part just deals with plain objects and eventually the persistence. So that lib/bookshelf.rb may want to use top level Lotus::Model:

Lotus::Model.configure do
  mapping # we only have block, but we want path too.
end

For instance we may want to load definitions from lib/config/mapping.rb.
Does it makes sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants