Kevin Hastie wrote:
> Kevin Hastie wrote:
>
> I guess what I really want is something like this:
>
> class Address< ActiveRecord::Base
> belongs_to :addressable, :polymorphic => true
> end
>
> class Business< ActiveRecord::Base
> has_one :address, :as
Kevin Hastie wrote:
I guess what I really want is something like this:
class Address< ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end
class Business< ActiveRecord::Base
has_one :address, :as => :addressable
end
class School < ActiveRecord::Base
has_on
Kevin Hastie wrote:
> a) Am I doing this right?
Apparently not.
Weird. Is it because I didn't do polymorphic anywhere that Address now
has a business_id, a credit_card_id and a user_id? Obviously this is no
good - I'd prefer the Business table to have an address_id, etc So:
First, I am very new to ruby and rails. Searching for "references" is
really tough, and so I've finally come here.
I'm trying to create a scaffold. Let's say a Business and a School both
can have a single Address (not shared). In a different case, an Offer
has an OfferType (with just a type_id
4 matches
Mail list logo