Comments (6)
Hi @rfernand. Which version are you using? Can you please add a stacktrace, or specify the necessary steps to see this?
add_badge
, along with badge_ids, badges, points, rm_badge, add_points and substract_points
are methods that internally get delegated to sash. Sash should be invisible to applications. Thanks for reporting!
from merit.
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.
from merit.
I am using Rails 3.2.11, with:
merit (1.0.1)
ambry (~> 0.3.0)
When i try to use add_badge or rm_badge in my has_merit model, an undefined method is thrown:
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!
from merit.
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 Badge#grant_to(meritable_object)
, which is since 1.2.0
invalid syntax.
from merit.
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.
from merit.
Yes, updating merit worked as expected. Thanks!
from merit.
Related Issues (20)
- undefined method 'create' for Merit:Action:Class HOT 12
- Use DeviseInvitable with Merit HOT 2
- Display flash messages to notify users when they obtain badges/points HOT 9
- Adding points doesn't work the first time HOT 1
- Display a specific badge and the users who obtained it HOT 2
- Merit 4.0 causing Heroku deployment errors HOT 4
- Typo in active_record/merit_generator task
- Deprecation warning: Expected string default value for '--orm'; got false (boolean). HOT 3
- Granting badges with Devise Registrations#update not working HOT 11
- rails g merit:install don't generating migrations on Rails6 HOT 18
- can't write unknown attribute `sash_id` when calling points method on user HOT 3
- subtract_points is not working HOT 3
- Missing index on merit_actions table for processed HOT 2
- Error on create merit_actions migration file HOT 2
- Score on namespaced/controller#action, can not trigger Merit::Action HOT 6
- Error every time code changes HOT 7
- do not support grape? HOT 1
- Devise & Sign-in then trigger grant_on HOT 12
- On destroy, Integer returned instead of object HOT 11
- Urgent Help : Duplicate key entry HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from merit.