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
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.