app/controllers/concerns/adminpanel/rest_actions.rb in adminpanel-2.1.0 vs app/controllers/concerns/adminpanel/rest_actions.rb in adminpanel-2.1.1
- old
+ new
@@ -20,13 +20,11 @@
format.js { render 'shared/new', :locals => { :resource => resource }}
end
end
def create
- params.merge({:model => params[:model]}) if params[:model].present?
- params.merge({:model_name => params[:model_name]}) if params[:model_name].present?
- params.merge({:belongs_request => params[:belongs_request]}) if params[:belongs_request].present?
+ merge_params
create! do |success, failure|
success.html do
flash[:success] = I18n.t('action.save_success')
redirect_to resource
end
@@ -101,8 +99,15 @@
if class_variable.respond_to?("of_model")
@collections.merge!({"#{class_variable}" => class_variable.of_model(@model.display_name)})
else
@collections.merge!({"#{class_variable}" => class_variable.all})
end
+ end
+
+ def merge_params
+ params.merge({:model => params[:model]}) if params[:model].present?
+ params.merge({:model_name => params[:model_name]}) if params[:model_name].present?
+ params.merge({:belongs_request => params[:belongs_request]}) if params[:belongs_request].present?
+ params.merge({:currentcontroller => params[:currentcontroller]}) if params[:currentcontroller].present?
end
end
end