search for: proxy_own

Displaying 6 results from an estimated 6 matches for "proxy_own".

Did you mean: proxy_owner
2007 May 28
2
Rails, respond_to? over anonymous module (extend has_many).
...class Playlist < ActiveRecord::Base # associations go here has_many :playlist_items, :order => :position, :dependent => :destroy has_many :assets, :through => :playlist_items, :order => :position do def << (*assets) assets.flatten.each do |asset| item = proxy_owner.playlist_items.build(:asset => asset) item.save unless proxy_owner.new_record? proxy_owner.duration += asset.duration end proxy_owner.save unless proxy_owner.new_record? end def delete_at (position) pli = proxy_owner.playlist_items.find_by_position(po...
2008 Nov 19
3
Overwriting / Decorating ActiveRecord association accessor
Hi, I am trying to overwrite the accessor of a has_many association. Basically my class looks like this: class Person has_many :emails has_one :link, :class_name => ''PersonProxy'' def emails_with_link link.emails + emails_without_link end alias_method_chain :emails, :link end Now that works fine if I only access the collection like >>
2009 Aug 28
2
Association extension method
...; ActiveRecord::Base belongs_to :dropzone has_many :transactions end class Dropzone < ActiveRecord::Base has_many :transactions, :through => :accounts do def limited_to(transaction) scope = Transaction.scoped({ :conditions => [''account.dropzone_id = ?'', proxy_owner.id], :joins => :account }) scope end end end In a controller, I''d like to write: current_dropzone.transactions.limited_to(@transaction) but, I get the error: RuntimeError: ERROR C42P01 Mmissing FROM-clause entry for...
2007 Jan 31
1
help with extensions
I am working with extensions to has_many associations, and I want to create a finder method that is conditional on the attributes of the object whose association I''m working with. So, to use the example from the Agile Web Development: the authors show on pg 340 in the second edition how to pass an argument to a finder method. But I want to know if it''s possible to instead have
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
...##### 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", "updat...
2010 Feb 11
3
Parameterized ActiveRecord Associations: Any such thing?
Hi list, how are ya? So, my current project is just begging for the ability to have parameterized associations in my ActiveRecord classes. Basically I need something that is a cross between named scopes and standard associations (has_many specifically). I''m wondering if such a thing exists or, if not, if anyone else has an elegant, equivalent solution? Example: class Sprocket <