search for: find_all_from_container

Displaying 1 result from an estimated 1 matches for "find_all_from_container".

2007 Aug 02
7
has_many and class function
Hello, i have two models : class Container < ActiveRecord::Base has_many :bottles end class Bottle < ActiveRecord::Base belongs_to :container def self.find_all_from_container(container) container.bottles.find(:all) end end i was asking myself if there was a better way to write the function find_all_from_container : i can call it from an instance of Container but how to pass the container instance directly (ie without giving the argument). To replace this...