Reputation: 8961
I have succsfuly set up an image upload with the carrierwave
gem.
but when I try to add an optional online url like so:
<%= 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 %>
then I get this error:
Can't mass-assign protected attributes:
my model is
class Rating < ActiveRecord::Base
attr_accessible :pic_url, :rating
mount_uploader :pic_url , ImageUploader
end
Upvotes: 0
Views: 96
Reputation: 35533
You need to be able to mass-assign the remote_pic_url_url
attribute:
class Rating < ActiveRecord::Base
attr_accessible :pic_url, :remote_pic_url_url, :rating
mount_uploader :pic_url , ImageUploader
end
Upvotes: 1