Displaying 5 results from an estimated 5 matches for "addressable_id".
2006 Jul 30
3
ActiveRecord - Multiple Address for a single record
...=> false
t.column :address_line_2, :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...
2007 Apr 22
0
rename error using rebuild_index in console after searching
...@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"=>"Alaska"}>,
#<Address:0x4f30
06c @ferret_score=0.106434106826782, @...
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
2010 Mar 29
0
Polymorphic association and has_one retrieval issues
class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end
class Client < ActiveRecord::Base
has_one :address, :as => :addressable
end
Now I''am able to create a correct entry in the db for address with
addressable_id = 1#client_id
addreassable_type = ''Client''
but when I retrieve
client = Client.find(1) --> return client instance with id =1
address = client.address -> address is not nil
BUT
address.attributes == nil
Somehow I can''t retrieve the address back using association
c...
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
...e lines with
########### signs..
First on to: class Organization
class Organization < ActiveRecord::Base
acts_as_paranoid
has_one :contact_address, :as => :addressable, :dependent
=> :destroy do
def with_deleted
ContactAddress.with_scope(:find => {:conditions =>
"addressable_id = #{proxy_owner.id}"}) do
find_with_deleted(:all)
end
end
end
Loading development environment.
>> sc = SportClub.find_with_deleted(7)
=> #<SportClub:0xb769c1a4 @attributes={"number_of_members"=>nil,
"name"=>"Maastricht Wildcats"...