|| at Jan 25, 2012 at 8:56 am
On 25 January 2012 08:36, amvis wrote:
can i use like this..
task :my_task => [:environment] do
class MofobirakesController < ApplicationController
puts "hai rails3"
what is the difference in that way to do in controller and in model..?
The difference is that controller actions are intended to be run in
response to http requests. To try and run one as part of a rake
action does not make logical sense.
You ask at the top whether it would work, I have no idea whether it
would work or not and it is irrelevant because there is no sense in
doing it. If you have code that is common between a controller action
and a rake task then the code should not be in a controller action.
Move it to a model or into lib and call it from the controller and the
What does the code that you want to call do?
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to email@example.com.
To unsubscribe from this group, send email to firstname.lastname@example.org.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.