It looks like you might have to create a custom action and view. One way to do this is to use this custom action plugin . There is also a tutorial on how to create a custom action here. I also used SmarterCSV and it works great.
To register a custom action with the Rails Admin, you must do this in config / initializers / rails_admin.rb:
module RailsAdmin module Config module Actions class YourClass < RailsAdmin::Config::Actions::Base RailsAdmin::Config::Actions.register(self) ##code here, as explained more below end end end end
In this class, you can inherit any basic actions . So, to register a user partial, in this class you would do:
# View partial name (called in default :controller block) register_instance_option :template_name do :your_class end
Your partial parts of your _your_class should be in app / views / rails_admin / main /, you can process the form using multipart. I do not include partial code, if you want me to make a swing in it, let me know.
You may also need your actions in the area of ββthe model:
register_instance_option :collection? do true end
And enter the controller code. It is probably best to handle the processing here, for example:
register_instance_option :controller do Proc.new do @order = Order.import(params[:file]) f = SmarterCSV.process(file.tempfile) f.each do |r| #combine date and time fields r[:date_time] = [r[:date],r[:time]].join(' ') Order.create("date" => r[:date_time]) end end end
Then your action should be logged in RailsAdmin :: Config :: Actions like this (this code was placed in config / initializers / rails_admin.rb):
module RailsAdmin module Config module Actions class ApproveReview < RailsAdmin::Config::Actions::Base RailsAdmin::Config::Actions.register(self) end end end end
Then user actions should be specified in the action configurations in config / initializers / rails_admin.rb:
RailsAdmin.config do |config| config.actions do dashboard index new your_class show edit delete end end
The tutorial has more detailed information, but I think it should be a pretty solid start!