[Prev] Thread [Next] |
[Prev] Date [Next]
Re: [Engine-Users] adding belongs_to to an application model from an engine
Fri Oct 31 03:00:41 2008
On Thu, Oct 30, 2008 at 2:59 PM, James Adam <[EMAIL PROTECTED]> wrote:
> On 30 Oct 2008, at 13:56, Raphael Bauduin wrote:
>> Yes, but I'm looking at engines to be able to add this without
>> touching the main app.
>> Actually I'm building a new datatype for dedomenon.org , and it would
>> be great if it was possible without touching the main application's
>> code: just install the engine and you're done.
>> Isn't there a way to achieve this?
>> Thanks for your help!
> In this case, you'll need to ensure that the main application instance.rb
> model is loaded before you reopen the class in your plugin. I would probably
> do something along the lines of
> require 'instance_extensions'
> require 'instance' # maybe raise an error here if it's missing in the main
> Instance.class_eval do
> has_many :web_file_attachments # ....
> Hope that helps,
It's going in the right direction, but it's not working yet as I get
this error when starting the application:
=> Booting WEBrick...
`before_destroy': wrong number of arguments (1 for 0) (ArgumentError)
... 26 levels...
from ./script/server:3:in `require'
The line causing the problem is
has_many :web_file_attachments , :dependent => :destroy
This exact same line put in the Instance class of the application works fine.
> Engine-Users mailing list
> [EMAIL PROTECTED]
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org
Engine-Users mailing list