Skip to content

Instantly share code, notes, and snippets.

@dburger
Created November 23, 2008 21:30
Show Gist options
  • Save dburger/28217 to your computer and use it in GitHub Desktop.
Save dburger/28217 to your computer and use it in GitHub Desktop.
class Message < ActiveRecord::Base
acts_as_nested_set :scope => 'discussable_id = #{discussable_id} AND discussable_type = \'#{discussable_type}\''
belongs_to :discussable, :polymorphic => true
# ...
end
class Foo < ActiveRecord::Base
has_many :messages, :as => :discussable
end
class Bar < ActiveRecord::Base
has_many :messages, :as => :discussable
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment