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!