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

Can only register models that have a primary key named "id" #23

Open
smgeorge99 opened this issue Nov 25, 2014 · 9 comments
Open

Can only register models that have a primary key named "id" #23

smgeorge99 opened this issue Nov 25, 2014 · 9 comments
Assignees

Comments

@smgeorge99
Copy link

Does any model registered for inclusion in the generated seeds file have to have a primary key named "id"? I was wondering if there was a way to configure the name of the PK for each model registered in the seed_migration.rb initializer. Or would this be a new feature that needed to be developed?

@pjambet
Copy link
Contributor

pjambet commented Nov 26, 2014

We indeed built it assuming that pks are name id. It could be interesting to add a config option to allow other names, with a default value of id, to keep everything backward compatible.

I won't have time to work on this in the next days/weeks, but I'd be happy to accept a Pull Request with those changes if you want to work on it.

Let me know if you have any questions.

@rubyrider
Copy link

I would suggest to add more dynamic stuffs, instead of lots of hardcoding, proxy method modules can come forward to sole those. And registry entry should contain more configuration options. There are also no options to handle different different table types other then primary tables. Example, a table without id or secondary table a joining tables etc. I have a plan to make a pull request tonight to solve this issue with more options to handle exceptional cases.

@pjambet
Copy link
Contributor

pjambet commented Nov 30, 2015

@rubyrider Thanks for your suggestions. Is that something that you've been working on? As mentioned in my first comment, I won't have time to work on this, but I would be happy to accept a PR solving this issue.

@rubyrider
Copy link

@pjambet if you want I can create a pr! I have solved this issue a long ago using a patch on that time.

@pjambet
Copy link
Contributor

pjambet commented Nov 30, 2015

Definitely! I would love to have a feature like that merged upstream.

Sorry again for not replying earlier.

@rubyrider
Copy link

its okey! :) I will send pr as soon as I get free time!

On Tue, Dec 1, 2015 at 12:16 AM, Pierre [email protected] wrote:

Definitely! I would love to have a feature like that merged upstream.

Sorry again for not replying earlier.


Reply to this email directly or view it on GitHub
#23 (comment)
.

Regards,
Irfan Ahmed Rizvi,
Freelancer- Senior Ruby on Rails Developer
https://www.odesk.com/users/~01c44db951895e4589
m: +880 1766 67 81 30
e: [email protected]

@pjambet
Copy link
Contributor

pjambet commented Nov 30, 2015

@rubyrider Awesome, thanks!

@rubyrider
Copy link

okey, I will do!

@jfoo1984
Copy link
Contributor

#80 might partially address this issue, as it doesn't require an id field on models

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

5 participants