search for: find_by_pk_code_nam

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

Did you mean: find_by_pk_code_name
2010 Aug 19
1
Composite primary keys and :joins=>
..._a.name AS pk_name" def self.get_all all(:select=>SELECT, :joins=>:code_name) end end class TableA < AR::Base set_table_name ''table_a'' set primary_keys :type_key, :code_key # using the composite primary keys gem 2.3.2 def self.find_by_pk_code_name(*args) # pk method invoked by belongs_to in TableB opts = args.extract_options! pk_type_key = "FOOKEY" pk_code_key = args.first find([pk_type_key, pk_code_key], opts) rescue ActiveRecord::RecordNotFound end end Console: x=TableB.first x...