How to call a controller from the rake file, Just i have tried to create
a controller object in rake, and call the method, but i didn't get that...
also how to link the helper class with the rake?

--
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/-/ewjMsae-ovoJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Colin Law at Jan 25, 2012 at 8:06 am

    On 25 January 2012 05:39, amvis wrote:
    How to call a controller from  the rake file, Just i have tried  to create a
    controller object in rake, and call the method, but i didn't get that...
    also how to link the helper class with the rake?
    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

    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Amvis at Jan 25, 2012 at 8:36 am
    can i use like this..

    *myrake file*

    task :my_task => [:environment] do
    rd=*MofobirakesController*.new
    rd.index
    end

    *Controller file*
    *
    *
    *
    *
    class *MofobirakesController* < ApplicationController
    def index
    puts "hai rails3"
    end
    end

    what is the difference in that way to do in controller and in model..?

    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Jan 25, 2012 at 8:56 am

    On 25 January 2012 08:36, amvis wrote:
    can i use like this..

    myrake file

    task :my_task => [:environment] do
    rd=MofobirakesController.new
    rd.index
    end

    Controller file


    class MofobirakesController < ApplicationController
    def index
    puts "hai rails3"
    end
    end

    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
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    gplus.to/clanlaw

    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Amvis at Jan 25, 2012 at 11:55 am
    Basically i need to write one cron job for running the rake file from
    which, i'll call one class, that have one query which will take data from
    some tables and will put into another tables. This is my objective. But
    now created one *.rb file in lib/ directory and created one .rake in task/
    directory. *Also* call the .rb file from the rake.* This is now working....

    Is it enough for my operation?



    Thank you
    vishnu

    --
    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/-/H9ZakQQ4L7QJ.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Jan 25, 2012 at 12:21 pm

    On 25 January 2012 11:55, amvis wrote:
    Basically i need to write one cron job for running the rake file from
    which, i'll call one class, that have one query which will take data from
    some  tables and will put into another tables. This is my objective. But now
    created one .rb file in lib/ directory and created one .rake in task/
    directory. Also call the .rb file from the rake. This is now working....

    Is it enough for my operation?
    I don't understand, you say "This is now working" but then ask if it is enough.

    Colin

    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 25, '12 at 5:39a
activeJan 25, '12 at 12:21p
posts6
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Colin Law: 3 posts Amvis: 3 posts

People

Translate

site design / logo © 2021 Grokbase