0

I have installed the carrierwave gem. my model is

class Rating < ActiveRecord::Base
  attr_accessible :pic_url, :rating

  mount_uploader :pic_url , ImageUploader
end

and my view for is

<%= form_for @rating, :html => {:multipart=>true} do |f| %>

    <div class="field">
       <%= f.file_field :pic_url %>
    </div>

    <div class="field">
      <%= f.label :remote_pic_url_url, 'or image url' %>
      <br/>
      <%= f.text_field :remote_pic_url_url %>
    </div>

    <div class="actions">
      <%= f.submit 'Upload Picture', :class => 'btn btn-primary' %>
    </div>
<% end %>

I get an error msg Can't mass-assign protected attributes: remote_pic_url_url when I remove the optional pic url field , then It works.

1 Answer 1

2

Just add remote_file_url to attr_accessible.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.