ruby api has_many syntax # sign -
in ruby api, examples has_many associations
example: firm class declares has_many :clients, add:
firm#clients (similar clients.find :all, :conditions => ["firm_id = ?", id]) firm#clients<< firm#clients.delete firm#clients= firm#client_ids
why arn't methods firm.clients, firm.clients<< etc.. # sign mean?
if written firm.clients
, mean it's method call on firm
, not on instances of it. if there particular instance firm
on want call method, can write firm.clients
. 1 purpose of api show methods available on instance of class. firm#clients
means method call of clients
on arbitrary instance of firm
. #
used in way not part of ruby syntax, established convention.
Comments
Post a Comment