asdasd

Ruby code posted by asdasd
created at 01 Aug 06:56

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class PostsController < ApplicationController

  def index
    @posts = Post.all
  end

  def new
  end

  def create
    @post = Post.new(post_params)
    
    @post.save
    redirect_to @post
  end

  def show
    @post = Post.find(params[:id])
  end

  private

    def post_params
      params.require(:post).permit(:title, :text)
    end

end
375 Bytes in 2 ms with coderay