0bserver07
0bserver07

Reputation: 3471

Rails: How can I relate to an object through an association?

I'm adding this reputation system (twiiter rep system) to Act_As_Taggable_on so, right now I want to add the reputation to the Taggings table, like the following:

#config/initializers/act_as_taggable_on.rb


ActsAsTaggableOn::Tagging.class_eval do
    has_reputation :post_points,
    :source => :user # this is where I'm stuck
end

I want to say user through the Tags user_id, how can I right that in ruby syntax ?

Upvotes: 0

Views: 32

Answers (1)

Awhitey98
Awhitey98

Reputation: 167

You may want to check out this blog post on how to build a blog. Scroll down to section 13 which shows how to use tags and taggings models and how to associate them. It may help you out a bit.

http://tutorials.jumpstartlab.com/projects/blogger.html

      has_many :taggings
      has_many :tags, through: :taggings

Upvotes: 1

Related Questions