Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

youtube

class ArticlesController < ApplicationController
  def index
    @articles = Article.recent
  end

  def show
    @article = Article.find(params[:id])
    fresh_when etag: @article
  end

  def create
    article = Article.create!(article_params)
    redirect_to article
  end

  private
    def article_params
      params.require(:article).permit(:title, :content)
    end
end
Source by rubyonrails.org #
 
PREVIOUS NEXT
Tagged: #youtube
ADD COMMENT
Topic
Name
3+9 =