所以我使用 fb_graph gem 从 facebook 中提取数据以在我的应用程序中创建新事件。麻烦的是,我似乎无法使用 remote_image_url 来让图片通过carrierwave 上传。这是来自 organization.rb 的代码:
page = FbGraph::Page.fetch(uri, :access_token => token)
org_events = page.events({:fields => "name,description,picture,id,location,start_time"})
org_events.each do |event|
Event.create!(
:name => event.name,
:description => event.description,
:location => event.location,
:date =>event.start_time ,
:time => event.start_time,
:organization_id => self.id,
:remote_image_url => event.picture #broken code
)
end
这是模型顶部的已安装上传器和图像属性:
attr_accessible :image
mount_uploader :image, ImageUploader
这是我遇到的错误消息-
Can't mass-assign protected attributes: remote_image_url