Forum: Ruby on Rails redirect from a collection_action to another class

Posted by Anna (Guest)
on 2012-11-07 14:44
(Received via mailing list)
Hi! I'm new at ruby,I want to redirect from here in app/admin:

*collection_action :status_race, :method => :post do*
*    #Do some import work..*
*    redirect_to #redirect to import class*
*  end *

To this class which is in app/lib/route:

*class ImportRoute*
* def  initialize*
* #parametres que tinga el fitxer*
* end*
* def run(filename)*
* puts "Running route import file"*
*
*
* raise "File" + filename + "doesn't not exist" unless 
File.exist(filename)*
*
*
* ri = RouteImporter.find(:name => self.class.name)*
*
*
* if(ri.nil?)*
* puts "Error, file doesn't exists"*
* end*
* CSV.foreach(filename, {:col_sep => @seperator}) do |row|*
*                .*
*                .*
*                .*
*                .*
*                .*
* end*
*
*
I don't know how can I do this, I've been trying few things like :action 
=>
:import_route, but it doesn't work, or if maybe should I do it in 
another
way?
Any idea? Thanks!
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.