Created
July 7, 2014 09:16
-
-
Save y00rb/809b75b81905f8a8c8ee to your computer and use it in GitHub Desktop.
how to organize getting fat models.
This file contains hidden or 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
# app/models/invoice.rb | |
class Invoice < ActiveRecord::Base | |
has_many :items | |
end | |
# app/models/invoice.rb | |
class Item < ActiveRecord::Base | |
belongs_to :invoice | |
end | |
# app/models/invoice/item.rb | |
################################### | |
## refactor Item as follow | |
################################### | |
class Invoice::Item < ActiveRecord::Base | |
belongs_to :invoice | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment