Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Andris's Profile

GitHub User: andris310

Comments by Andris

Avatar

For anyone trying to implement this in Rails 4 don't forget to add {:category_ids => []} to params in the products_controller

ruby
def product_params
  params.require(:product).permit(
    :name,
    {:category_ids => []}
  )
end

And in that case you don't need a hidden field <%= hidden_field_tag "#{f.object_name}[category_ids][]", nil %>
nor params[:product][:category_ids] ||= []

Avatar

When trying to debug, in ImageWorker method 'perform' product.image.direct_fog_url(with_path: true) is equal to:
"https://testbucket.s3.amazonaws.com/uploads/2b33ecda-2d3e-4962-b365-e55d07bae205/$%7Bfilename%7D"

Avatar

Using Rails 4.0.1 Carrierwave_direct solution. Images get uploaded to S3 but I'm geting an errors in the background processing:
"error_message"=>"Validation failed: Image could not download file: 403 Forbidden", "error_class"=>"ActiveRecord::RecordInvalid"

2013-11-14T16:56:09Z 3924 TID-owk35rblw WARN: Validation failed: Image could not download file: 403 Forbidden
2013-11-14T16:56:09Z 3924 TID-owk35rblw WARN: /Users/Andris/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.1/lib/active_record/validations.rb:57:in `save!'