Skip to content

Commit

Permalink
added ref polymorphic association for adding reasons/referenced objec…
Browse files Browse the repository at this point in the history
…ts on achievements
  • Loading branch information
lloydpick committed Mar 27, 2011
1 parent 3d17f4e commit dca2a4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ def self.up
t.integer :level
t.integer :achievable_id
t.string :achievable_type
t.integer :ref_id
t.string :ref_type

t.timestamps
end
Expand Down
1 change: 1 addition & 0 deletions lib/glory/achievement.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Achievement < ActiveRecord::Base

belongs_to :achievable, :polymorphic => true
belongs_to :ref, :polymorphic => true

scope :recent, :order => "created_at desc"
scope :kind_of, lambda { |type| {:conditions => {:type => type.to_s}}} do
Expand Down

0 comments on commit dca2a4f

Please sign in to comment.