GithubHelp home page GithubHelp logo

Comments (6)

tute avatar tute commented on August 18, 2024

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.

tute avatar tute commented on August 18, 2024

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.

rfernand avatar rfernand commented on August 18, 2024

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.

tute avatar tute commented on August 18, 2024

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.

rfernand avatar rfernand commented on August 18, 2024

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.

rfernand avatar rfernand commented on August 18, 2024

Yes, updating merit worked as expected. Thanks!

from merit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.