app/controllers/papermill_controller.rb in papermill-0.8.0 vs app/controllers/papermill_controller.rb in papermill-0.9.0

- old
+ new

@@ -37,11 +37,11 @@ end def update @asset = PapermillAsset.find_by_id(params[:id]) render :update do |page| - if @asset && @asset.update(params) + if @asset && @asset.update_attributes(params[:papermill_asset]) page << %{ notify("#{t("updated", :ressource => @asset.name, :scope => "papermill")}", "notice") } else page << %{ notify("#{@asset && @asset.errors.full_messages.to_sentence || t("not-found", :ressource => params[:id].to_s, :scope => "papermill")}", "warning") } end end @@ -51,10 +51,12 @@ @asset = PapermillAsset.find params[:id] end def create asset_class = params[:asset_class].constantize - params[:assetable_type] = params[:assetable_type].camelize if params[:assetable_type] + params[:assetable_id] = params[:assetable_id].try :to_i + params[:assetable_type] = params[:assetable_type].try :camelize + params[:assetable_key] = params[:assetable_key].try :to_s params[:swfupload_file] = params.delete(:Filedata) unless params[:gallery] @old_asset = asset_class.find(:first, :conditions => params.reject{|k, v| ![:assetable_key, :assetable_type, :assetable_id].include?(k)}) end @asset = asset_class.new(params.reject{|k, v| !(PapermillAsset.columns.map(&:name)+["swfupload_file"]).include?(k)}) \ No newline at end of file