bradphelan / openkitchen

rails backend for gobbq
Other
2 stars 0 forks source link

add venue image failed #14

Closed vinzenzweber closed 12 years ago

vinzenzweber commented 12 years ago

trying to add venue image caused an "Application Error" on http://production.openkitchen.at/venue_images the image I tried to add is pretty huge 3888 × 2592 and got 2.4 MB may be the cause?

Application Error

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

vinzenzweber commented 12 years ago

now I tried again with a smaller image and got a "You are not authorized to access this page."

bradphelan commented 12 years ago

I put a limit of 1mb on uploads but it should not crash. On Mar 7, 2012 6:00 PM, "Vinzenz-Emanuel Weber" < reply@reply.github.com> wrote:

trying to add venue image caused an "Application Error" on http://production.openkitchen.at/venue_images the image I tried to add is pretty huge 3888 2592 and got 2.4 MB may be the cause?

Application Error

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.


Reply to this email directly or view it on GitHub: https://github.com/bradphelan/openkitchen/issues/14

bradphelan commented 12 years ago

Curious. Ill try myself again. Perhapps I broke the image upload again

vinzenzweber commented 12 years ago

not working yet ;)

bradphelan commented 12 years ago

It's a permission issue. Not sure why it is not working. Current permissions are

  can :create, VenueImage, :venue => { :user_venue_managements => { :user_id => user.id, :role => "manager" }}
  can :create, VenueImage, :venue => { :user_venue_managements => { :user_id => user.id, :role => "owner" }}
bradphelan commented 12 years ago

Solved Bloody attr_accessible issue. As always. venue_id is protected and can't be mass assigned ( lookup recent github security breakdown for reference ;) ) Fix is to manually assign it like so

@venue_image = VenueImage.new params[:venue_image] do |vi|
  vi[:venue_id] = params[:venue_image][:venue_id]
end