search for: addressable_typ

Displaying 5 results from an estimated 5 matches for "addressable_typ".

Did you mean: addressable_type
2006 May 09
7
polymorphic relation question
I am trying to get polymorphic relations to work for my app. What I am trying to do is explained by this picture http://iroll.org/code/ I can''t figure out the code for in the controller to create a new phone_number and assign it to a person. I have tried everything I can think of. A) do my models look correct? B) what would the commands look like in the console or a controller action
2006 Jul 30
3
ActiveRecord - Multiple Address for a single record
...:string t.column :city, :string, :null => false t.column :state, :string, :null => false t.column :zipcode, :string, :null => false t.column :country, :string t.column :addressable_id, :integer t.column :addressable_type, :string This would appear to give me the basic polymorphic assocation. Here is my challange. Mapping to location seems simple: class Location < ActiveRecord::Base has_one :address, :as => :addressable end What I''m having trouble with is the company model. I''ve cu...
2007 Apr 22
0
rename error using rebuild_index in console after searching
...#<ActsAsFerret::SearchResults:0x4f2ffcc @total_hits=2, @results=[#<Address:0x 4f30198 @ferret_score=0.106434106826782, @ferret_rank=1, @attributes={"city"=>"" , "updated_at"=>"2007-04-16 01:32:40", "zipcode"=>"11111", "addressable_type"=>" User", "country"=>"US", "addressable_id"=>"1", "id"=>"1", "line_1"=>"", "line_2" =>"", "created_at"=>"2007-03-19 22:06:04", "state&qu...
2006 Jul 31
3
Polymorphic associations and single table inheritance
...de like this: class Address < ActiveRecord::Base belongs_to :addressable, :polymorphic => true end class Person < ActiveRecord::Base has_many :addresses, :as => :addressable, :dependent => :destroy end class Member < Person end Adding an Address to a Member results in the addressable_type column equaling "Person" when it should be "Member". Looking in ActiveRecord::Associations::AssociationProxy#set_belongs_to_association_for and ActiveRecord::Associations:: HasManyAssociation#construct_sql it''s clear why. >From ActiveRecord::Associations::Asso...
2006 Oct 11
1
Polymorphic Validations
Hi Everyone, Ran into an interesting case last night, and I was hoping that someone on the list here could give me some guidance. I''ve got a Polymorphic association for Addresses (which can belong to two different models). The catch is, one model requires a strict, precise address, and the other only requires a City, State and Postal Code. I want to use :validates_presence_of :street,