I want associate the attributes model with whole model and not with single record.
thx
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e5498711-d424-42bf-bbed-aebedc3a64d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
class Picture < ActiveRecord::Base
belongs_to :imageable, polymorphic: true
#table pictures (id, name, imageable_id, imageable_type)
# how use it without imageable_id
end
class Employee < ActiveRecord::Base
has_many :pictures, as: :imageable
end
class Product < ActiveRecord::Base
has_many :pictures, as: :imageable
end
class product < AR::Base
serialize :metadata , Hash
#i save all my custom attributes in metadata column
def get_all_custom_attributes
My_custom_field.find_by_model(self.class.name)
end
end