Hi there,

We're having some problems with some code in our Engine:

This code, in our _application's_ (not the engine's) user_controller
goes wrong:
        current_company = current_user.employees[0].company
it raises an exception that the method 'company' does not exist for
the instance of Employee current_user.employees[0].

Employee is defined in the application itself, and User is defined in
the engine.  Employee belongs_to :company and Company has_many :employees.

This works fine:
        current_company = Company.find(current_user.employees[0].company_id)

To check it's not because the user object is instantiated in code from our
engine, I tried this:
        current_company = User.find(current_user.id).employees[0].company
This didn't work either.  Gives the same error (unknown method company for
Employee)

Any ideas what could cause this?  (or if it could be engines-related at all)

Regards,
Peter Bex
Solide ICT - http://www.solide-ict.nl
_______________________________________________
engine-developers mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

Reply via email to