I’m just getting rolling with RoR so I’m sure this is pretty basic. Let’s say I have two models: Account and Transaction
class Account < ActiveRecord::Base has_many :transactions end class Transaction < ActiveRecord::Base belongs_to :account end
What methods (for each model) become available/are auto generated after I make this association?
Thanks
It depends. Some methods (e.g. Account#transactions, Transaction#account) will be there from the get-go. Others will be created as needed (via a method_missing hook) such as dynamic finders. The exact list can depend on other factors, including things like acts_as, etc. used elsewhere.
Are you concerned about which ones are created or about what the full possibilities are?
— MarkusQ
P.S. See here for more:
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html