hello,
I have a model (item) with one attachment (photo) and one style (small):
class Producto < ActiveRecord::Base
has_attached_file :photo, :styles => { :small => “50x50”},
end
I would like to add a new style (:large), so I modify item.rb:
class Producto < ActiveRecord::Base
has_attached_file :photo, :styles => {{ :small => “50x50”},{ :large =>
“150x150”}}
end
it seems to be ok, but when I submit in edit or new views, I get the
following error:
NoMethodError (undefined method []' for nil:NilClass): app/controllers/admin/items_controller.rb:64:in
update’
app/controllers/admin/items_controller.rb:63:in `update’
Controller code:
def update
@item = Item.find(params[:id])
respond_to do |format|
if @item.update_attributes(params[:item])
format.html { redirect_to(admin_items_path, :notice => ‘OK’) }
else
format.html { render :action => “edit” }
end
end
end
If I remove the new style (:large) in item.rb everything works fine
again…
Could someone help me?
Thanks