-
Notifications
You must be signed in to change notification settings - Fork 197
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
There is an error in the documentation: current_user.add_badge => current_user.sash.add_badge #48
Comments
Hi @rfernand. Which version are you using? Can you please add a stacktrace, or specify the necessary steps to see this?
|
It's actually tested in https://github.com/tute/merit/blob/master/test/integration/navigation_test.rb#L18-L20. I'll close the issue to not confuse other programmers, but I'm interested in following up what happened in your app. |
I am using Rails 3.2.11, with: irb(main):003:0> user.add_badge
NoMethodError: undefined method `add_badge' for #<User:0x00000006e00848>
from /usr/lib/ruby/gems/1.9.1/gems/activemodel-3.2.11/lib/active_model/attribute_methods.rb:407:in `method_missing'
from /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/attribute_methods.rb:149:in `method_missing'
from (irb):3
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>' The weird thing is that I can call user.points, user.badges, user.badge_ids, user.add_points/substract_points without problems. Greetings! |
I'm surprised it even works, we are not supporting Rails 2.3 yet! In fact we use ARel syntax in many places. I think add_badge was added since version 1.2.0, so it makes sense you have to go through sash. You could also use |
Oh, I misstyped, it was Rails 3.2.11 (as you can see that in the backtrace). I will update my merit gem and check it again. |
Yes, updating merit worked as expected. Thanks! |
I just did not know were to notify this, so I will post it right here:
There is an error in the documentation, to add a badge manually to an user is not current_user.add_badge, one has to use current_user.sash.add_badge instead.
Greetings!
The text was updated successfully, but these errors were encountered: