Created
April 24, 2012 15:53
-
-
Save ohcibi/2480945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Page < ActiveRecord::Base | |
attr_accessible :title | |
has_many :page_widgets | |
has_many :widgets, through: :page_widgets | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PageWidget < ActiveRecord::Base | |
attr_accessible :height, :offset_x, :offset_y, :width | |
belongs_to :page | |
belongs_to :widget | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Widget < ActiveRecord::Base | |
attr_accessible :content, :title | |
has_many :page_widgets | |
has_many :pages, through: :page_widgets | |
def put_on page | |
pages << page | |
# return new page_widget here | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment