Skip to content

Instantly share code, notes, and snippets.

@neotericdesign
Created November 16, 2010 16:25
Show Gist options
  • Select an option

  • Save neotericdesign/702011 to your computer and use it in GitHub Desktop.

Select an option

Save neotericdesign/702011 to your computer and use it in GitHub Desktop.
this worked in Rails2 RefineryCMS -- in the initializers folder
class Page
acts_as_commentable
has_many :page_widget_assignments
has_many :assigned_widgets, :through => :page_widget_assignments, :source => :widget
def widgets
if assigned_widgets.blank?
parent_id? ? parent.widgets : Widget.system
else
assigned_widgets
end
end
def body
return self[:body]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment