Alright so I've spent considerable amount of time with this and still can't find out what's wrong.
Here's whats going on: I've got a model reward.rb with a method X like this:
class Reward < ActiveRecord::Base def x puts "foo" # Method does something... end end
The rails app is now on a production environment, in development, if you do
>> r = Reward.new >> r.x "foo" # I.e it works...
now, if you go into the server and do
>> r = Reward.new >> r.x NoMethodError: undefined method `x' for #<Reward:0x0000000561fa08>
If you check reward.rb in the same server you'll see the method's there, actually it's the first method in the file... so, as I can see Rails is not loading the latest code of the model when it loads the console...
I thought it might have something to do with Rails' cache but production.rb says:
MyApp::Application.configure do config.cache_classes = false config.action_controller.consider_all_requests_local = false config.action_controller.perform_caching = false # SMTP settings and other stuff.. not related to caching... end
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application MyApp::Application.initialize!
module MyApp class Application < Rails::Application config.encoding = "utf-8" config.filter_parameters += [:password] end end
So I've ran out of ideas... The app was deployed with capistrano, I'm using Rails 3.0.10.
Alright, so I figured out the problem, pretty silly to be honest, there was a models.bak folder inside app/ that someone created, on production the models were getting picked up from that folder