Ticket.all(:conditions => ['week(created_at) = ?', 25])
works in rails console. but does not work in the rails model.
How do I change the code so it works in the Ticket model?
Also, is there a way to make it an instance method so I can search only records of that instance:
tickets = john.tickets.on_week(25).all
However, i’m not sure if week function will work with Postgres but since it’s working for you on the console, i assume you’re not using that database.
Also it would be easier to help if you showed how you were calling the model like @Ryan Bigg commented.