Sha256: e9bcd48083e2970d984af09ca15315e9f899412e661c8027c92996adfa7b9ac7
Contents?: true
Size: 922 Bytes
Versions: 5
Compression:
Stored size: 922 Bytes
Contents
class ImagesController < ApplicationController respond_to :html # GET /images def index @images = Image.all respond_with(@images) end # GET /images/1 def show @image = Image.find(params[:id]) respond_with(@image) end # GET /images/new def new @image = Image.new respond_with(@image) end # GET /images/1/edit def edit @image = Image.find(params[:id]) respond_with(@image) end # POST /images def create @image = Image.create(attributes) @image.save respond_with(@image) end # PUT /images/1 def update @image = Image.find(params[:id]) @image.attributes = attributes @image.save respond_with(@image) end # DELETE /images/1 def destroy @image = Image.find(params[:id]) @image.destroy respond_with(@image) end private def attributes params.require(:image).permit(:name, :file) end end
Version data entries
5 entries across 5 versions & 1 rubygems