Skip to content

Strong Parameters -> Asset upload error #11

Open
@Allanon29

Description

@Allanon29

Hi,

Thank You for this great gem! I am trying to implement it into one of my current projects ,but I have some small (or maybe not so small) bugs to report.

The gem created an Assets menu in ActiveAdmin which is great, but when I try to add an asset I get a Forbiddenattributes error. I guess this is because I use the strong parameters gem. I tried to create an assets.rb file in the admin folder to configure strong parameters, but it doesn't seem to work.

This is my Assets.rb file:
"ActiveAdmin.register Assets do

controller do 

    def new
      @asset = Asset.new
    end

    def create
      @asset = Asset.new(asset_params)
      @asset.save
      render active_admin_template('index.html.arb'), :layout => false
    end

    def show
      @asset = Asset.find_by_permalink(params[:id])
    end

      def edit
        @asset = Asset.find_by_permalink(params[:id])
      end

      def update
        @asset = Asset.find_by_permalink(params[:id])
        @asset.update_attributes(asset_params)
      render active_admin_template('edit.html.arb'), :layout => false
      end

    def destroy
      @asset = Asset.find_by_permalink(params[:id])
      @asset.destroy
      render active_admin_template('index.html.arb'), :layout => false
    end

      def asset_params
        asset_params = params.require(:asset).permit(:asset,:storage,:retained_storage,:storage_url)
      end

end

end "

The above approach works on other content assets.
Any idea why it doesn't with assets?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions