Created
February 7, 2013 07:14
-
-
Save itsNikolay/4729133 to your computer and use it in GitHub Desktop.
model
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
$> rake g migraiton add_institution_id_to_users institution_id:integer | |
$> rake g migration add_user_id_to_loans user_id:integer | |
$> rake g migration add_loan_id_to_quotes loan_id:integer | |
$> rake g migration add_institution_id_to_type_of_loans institution_id:integer | |
models/institutions.rb | |
class Institution < ActiveRecord::Base | |
has_many :users | |
has_many :type_of_loans | |
end | |
models/user.rb | |
class User < ActiveRecord::Base | |
has_many :loans | |
belongs_to :institution | |
end | |
models/loan.rb | |
class Loan < ActiveRecord::Base | |
has_many :quotes | |
belongs_to :user | |
end | |
model/quote.rb | |
class Quote < ActiveRecord::Base | |
belongs_to :loan | |
end | |
model/type_of_loan.rb | |
class TypeOfLoan < ActiveRecord::Base | |
has_many :loans | |
belongs_to :institution | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment