Sha256: 86e8a6960ed5db488e17606d11389725ed0689862fe9d61239842f3e320ed712
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
class RailsDetailMy::SourcesController < RailsDetailMy::BaseController def index @sources = Source.all respond_to do |format| format.html format.json { render json: @sources } end end def show @source = Source.find(params[:id]) respond_to do |format| format.html format.json { render json: @source } end end def new @source = Source.new respond_to do |format| format.html # new.html.erb format.json { render json: @source } end end # GET /sources/1/edit def edit @source = Source.find(params[:id]) end # POST /sources # POST /sources.json def create @source = Source.new(params[:source]) respond_to do |format| if @source.save format.html { redirect_to @source, notice: 'Source was successfully created.' } format.json { render json: @source, status: :created, location: @source } else format.html { render action: "new" } format.json { render json: @source.errors, status: :unprocessable_entity } end end end # PUT /sources/1 # PUT /sources/1.json def update @source = Source.find(params[:id]) respond_to do |format| if @source.update_attributes(params[:source]) format.html { redirect_to @source, notice: 'Source was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @source.errors, status: :unprocessable_entity } end end end # DELETE /sources/1 # DELETE /sources/1.json def destroy @source = Source.find(params[:id]) @source.destroy respond_to do |format| format.html { redirect_to sources_url } format.json { head :no_content } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_detail-0.0.1 | app/controllers/rails_detail_my/sources_controller.rb |