I don't believe it makes sense to call controller methods from a rake
task. Put the bits you want to call in a model and you can call them.
Similarly to call view helper models does not make sense. There is
no view so what good are view helpers? Put the code in models or in
lib.
Colin
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
rake task.
What does the code that you want to call do?
Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/bP0dF4CYiOcJ.
>
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
I don't understand, you say "This is now working" but then ask if it is enough.
Colin