carrierwave-mongoid-media/app/concerns/carrierwave_mongoid_media_controller.rb

30 lines
346 B
Ruby
Raw Permalink Normal View History

2013-03-11 20:21:59 +00:00
module CarrierwaveMongoidMediaController
def show
resource.as_response_for(self)
end
def create
with_ok { create! }
end
def create!
resource.update_attributes(params)
end
def destroy
with_ok { destroy! }
end
def destroy!
resource.destroy
end
private
def with_ok
yield
head :ok
end
end