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

Path glob to mapper files #245

Closed
matheusca opened this issue Oct 9, 2015 · 5 comments
Closed

Path glob to mapper files #245

matheusca opened this issue Oct 9, 2015 · 5 comments
Assignees
Labels

Comments

@matheusca
Copy link

Hi!

Organize my mapping files I separate mapping in many files that makes sense for me. So I created a main mapping file that it got all path, as following:

Lotus::Model.configure do
  adapter type: :sql, ...

  mapping 'mapping/users'
  mapping 'mapping/tasks'
  mapping 'mapping/scheduled'
end

It works very well, but it more redundancy for each mapping I will need putting these files in main mapping file.

My suggestion if will be possible use a glob path in main file. For instance, my file could be more elegant as following:

Lotus::Model.configure do
  adapter type: :sql, ...

  mapping 'mapping/*'
end

I saw that it is not possible at the moment, because the Config::Model(https://github.com/lotus/model/blob/master/lib/lotus/model/config/mapper.rb#L34) try get a realpath.

If guys agree with me, I will implement it refactoring the code.

@matheusca matheusca changed the title Path glob to mapping files Path glob to mapper files Oct 9, 2015
@AlfonsoUceda
Copy link
Contributor

I like the idea to separate in several files the mapping, because in big applications the mapping will be big.

what do you think @lotus/core-team ?

@runlevel5
Copy link
Member

@AlfonsoUceda I do like this idea too, I even think that having lib/bookshelf/mappers as a conventional placeholder. Thoughts?

@AlfonsoUceda
Copy link
Contributor

👍

@runlevel5
Copy link
Member

On second look, doing multiple mapping does not work correctly in the current version, the latter one would override the one before that. So the PR should also handle that first.

@runlevel5 runlevel5 added this to the v0.5.1 milestone Oct 13, 2015
@jodosha jodosha removed this from the v0.6.0 milestone Nov 23, 2015
@jodosha jodosha self-assigned this Nov 8, 2016
@jodosha
Copy link
Member

jodosha commented Nov 10, 2016

As of v0.7.0 we don't support global mapping anymore.

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

No branches or pull requests

4 participants