generate_load_dump_actions_for
Example:
generate_load_dump_actions_for Inventory
That's all there is to it. Then in the view, you have to create a form and links for the csv and yaml actions, respectively:
= "| #{link_to 'Export Yaml', dump_models_path(:controller => 'equipmentis')}" if @equipmentis.length > 0
= "| #{link_to 'Import Yaml', load_models_path(:controller => 'equipmentis')}" if @equipmentis.length == 0
.form_container
- error_handling_form_for :dump, :url => {:controller => controller, :action => 'load_model_from_csv'}, :html => {:multipart => true} do |f|
%fieldset
%legend Import CSV
= f.file_field :file, {:label => 'Select a CSV file', :message => '(make sure first row has headers)'}
= f.submit 'Import'
0 comments:
Post a Comment