> class Stuff < ActiveRecord::Base
> belongs_to :thing
>
> my_plugin :id => self.thing.other_id
>
> end
This is impossible. self in the above snippet is the Stuff class. I'm
assuming you want that to use a instance of Stuff at the time some
magical method is called. You have to use a block
class Stuff < ActiveRecord::Base
my_plugin do |stuff|
{:id => stuff.thing.other_id}
end
end
The my_plugin method has to know how to store that block so that the
instance can call it, passing itself as the first argument.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---