Namespace
Methods
C
D
E
I
N
R
S
U
Included Modules
Instance Public methods
create()

POST /posts POST /posts.json

# File railties/guides/code/getting_started/app/controllers/posts_controller.rb, line 43
def create
  @post = Post.new(params[:post])

  respond_to do |format|
    if @post.save
      format.html { redirect_to @post, notice: 'Post was successfully created.' }
      format.json { render json: @post, status: :created, location: @post }
    else
      format.html { render action: "new" }
      format.json { render json: @post.errors, status: :unprocessable_entity }
    end
  end
end
destroy()

DELETE /posts/1 DELETE /posts/1.json

# File railties/guides/code/getting_started/app/controllers/posts_controller.rb, line 75
def destroy
  @post = Post.find(params[:id])
  @post.destroy

  respond_to do |format|
    format.html { redirect_to posts_url }
    format.json { head :no_content }
  end
end
edit()

GET /posts/1/edit

# File railties/guides/code/getting_started/app/controllers/posts_controller.rb, line 37
def edit
  @post = Post.find(params[:id])
end
index()

GET /posts GET /posts.json

# File railties/guides/code/getting_started/app/controllers/posts_controller.rb, line 5
def index
  @posts = Post.all

  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @posts }
  end
end
new()

GET /posts/new GET /posts/new.json

# File railties/guides/code/getting_started/app/controllers/posts_controller.rb, line 27
def new
  @post = Post.new

  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @post }
  end
end
rescue_action(e)
# File actionpack/test/controller/filters_test.rb, line 831
def rescue_action(e); raise e; end
show()
# File actionpack/test/dispatch/prefix_generation_test.rb, line 328
def show
  render :text => post_path(:id => params[:id])
end
show_detailed_exceptions?()
# File railties/test/application/assets_test.rb, line 250
def show_detailed_exceptions?() true end
update()

PUT /posts/1 PUT /posts/1.json

# File railties/guides/code/getting_started/app/controllers/posts_controller.rb, line 59
def update
  @post = Post.find(params[:id])

  respond_to do |format|
    if @post.update_attributes(params[:post])
      format.html { redirect_to @post, notice: 'Post was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @post.errors, status: :unprocessable_entity }
    end
  end
end