Created
April 5, 2012 00:05
-
-
Save deJaVisions/2306697 to your computer and use it in GitHub Desktop.
slugged gem getting ActiveModel::MassAssignmentSecurity::Error in Admin::MaterialsController#update all of the sudden
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def update | |
| @material = Material.find_using_slug(params[:id]) | |
| redirect_to admin_material_url if @material.nil? | |
| respond_to do |format| | |
| if @material.update_attributes(params[:material]) | |
| unless params[:material][:pdf].nil? | |
| @material.pdf = params[:material][:pdf] | |
| @material.save! | |
| end | |
| format.html { redirect_to edit_admin_material_path(@material), notice: 'Material Updated' } | |
| format.json { head :no_content, status: :success } | |
| else | |
| format.html { redirect_to edit_admin_material_path(@material), alert: @material.errors.full_messages } | |
| format.json { render json: @material.errors, status: :unprocessable_entity } | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment