-
Notifications
You must be signed in to change notification settings - Fork 12
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
Saving to db when it shouldn't #3
Comments
As you can see, I didn't touch my Simple Roles for a long time. Many thing could have been improved since then. I'll take a look. Also, I wouldn't mind if you will suggest a pull request to handle this. |
Ah, I see: I need to think, how to change it, so it would not affect current simple roles users. |
Yep, i kinda noticed it hadn't been updated for a while. But it's still the simplest way to implement roles :) I'm afraid i'm too much of a rails newbie to be suggesting any pull request. Thanks for your help. |
Could you please post a couple of strings here so we could discuss your method?
It was about how associations work - there was a problem with the fact that without calling
See http://stackoverflow.com/questions/15020016/does-has-many-association-attribute-setter-always-persist-its-value-to-a-databas I've just opened. The current |
I was talking about the I see you got an answer on stackoverflow. The virtual attribute seems a good idea. It seems to me that this could absolve you from making breaking changes though that virtual attribute would need to have an other name than just "roles" making the getting roles part a bit trickier. Anyway, if you want to keep things clean so that everyone can still use |
I don't really like the current way it works and I am ready to make breaking changes. One way to achieve this is to place new Many roles classes just by the current ones and provide a configuration option to use new classes or old. Also it is possible to add deprecation message to current Many- files and hold it for a month or a couple of months or so. I would begin doing all this immediately after I've got a whole vision of new design. Let me know, if you have any ideas about how it could be done. |
stanislaw#3 Signed-off-by: Chris Boertien <chris@aktionlab.com>
@Crystark, please confirm, that it works for you now. |
Awesome, just changed me gemfile to: gem 'simple_roles', git: 'git://github.com/stanislaw/simple_roles.git' And it works like a charm =) Are you planning to tag it 0.0.9 ? @stanislaw and @Cluster444 Great work to both of you ! And many thanks ! |
I am glad it works for you now. I will release 0.0.9 right now. |
0.0.9 is released. |
Hi,
I'm working on me seed.db file. The goal is to insert the base roles and create an admin user. Here's what it looks like right now:
As you can see, this code should create the roles but as i haven't called
user.save
yet it should not be saving the user. Well as you probably guessed, it does save the user.I tried removing
roles: :admin
and then it worked as intended : no user saved.I actually need the user to be created so it's doesn't really bother me here but i think it shouldn't be acting like and it could be a problem in the future with the confirmation mail beeing sent and all... Or maybe am i doing something wrong ? (i'm quite new to rails)
Thanks for your help.
The text was updated successfully, but these errors were encountered: