I am trying to use rails console in the course of trying to make my application work, but things don't seem to work in rails console like they do in my application. I run rails console in a console in the application home directory.
In my employee controller, the following code executes and returns (mostly) what I expect:
@employee = Employee.find_by_number("10119")
@favorites = @employee.Favorite.find(:all)
Favorite is a join model and the second line executes just fine and returns what I expect.
However, in rails console:
@e = Employee.find_by_number("10119") works fine and returns the employee record.
But @f = @e.Favorite.find(:all) returns the error "undefined method 'Favorite' for #<Employee:....
What's up with this? Why is the method found when executed in the controller, but not when executed in rails console?