Sha256: 885800c67ca274936ec4ee84ad33badf342088f617e35fe38281748bf247ba09

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

class ChildModel < ActiveRecord::Base
  belongs_to :parent_model
  belongs_to :second_parent_model
  def parent_model_name
    parent_model.name if parent_model
  end
  def parent_model_name=(name)
    self.parent_model = ParentModel.find_by_name(name)
  end
  def second_parent_model_other_field
    second_parent_model.other_field if second_parent_model
  end
  def second_parent_model_other_field=(other_field)
    self.second_parent_model = SecondParentModel.find_by_other_field(other_field)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
view_mapper-0.3.4 test/views/belongs_to_auto_complete/expected_templates/child_model.rb