On 30 Oct 2008, at 13:35, Raphael Bauduin wrote:
Hi,
I have an Instance model in my application, to which I want to add a
has_many :web_file_attachment from the plugin.
I tried putting this in my plugin's app/model/instance.rb :
class Instance < ActiveRecord::Base
has_many :web_file_attachments , :dependent => :destroy
end
but it doesn't seem to work.
The engines plugin doesn't mix model code (yet), so it's unlikely that
your plugin model is being loaded.
A better way to do this would be to add a 'macro' method to
ActiveRecord::Base, which you can then call in your main application
model, along the lines of
app/models/instance.rb
class Instance < ActiveRecord::Base
# other stuff...
has_web_file_attachments
end
This would give you more flexibility, I think.
The main reason why your current setup doesn't work, is that the
engines plugin isn't loading your plugin model.
James
_______________________________________________
Engine-Users mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org