Sha256: 5187afc1c10084e01b5ceca307cd3eeb59f9e225212b1bdc57ca9773ba99ddcc

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

module Recruiter
  module Users
    class ArticlesController < UserController
      before_action :set_article, only: [:show, :edit, :update, :destroy]

      def index
        @articles = scope.page(page).per(per_page)
        respond_with(:user, @articles)
      end

      def show
        respond_with(:user, @article)
      end

      def new
        @article = scope.build
        respond_with(:user, @article)
      end

      def create
        @article = scope.build(article_params)
        crud_flash @article.save
        respond_with(:user, @article)
      end

      def edit
        respond_with(:user, @article)
      end

      def update
        crud_flash @article.update(article_params)
        respond_with(:user, @article)
      end

      def destroy
        crud_flash @article.destroy
        respond_with(:user, @article)
      end

      private

      def scope
        current_user.articles
      end

      def set_article
        @article = scope.find(params[:id])
      end

      def article_params
        params.require(:article).permit(:title, :body, :published)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
recruiter-1.1.11 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.10 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.9 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.8 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.7 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.6 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.5 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.4 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.3 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.2 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.1 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.1.0 app/controllers/recruiter/users/articles_controller.rb
recruiter-1.0.0 app/controllers/recruiter/users/articles_controller.rb
recruiter-0.1.5 app/controllers/recruiter/users/articles_controller.rb
recruiter-0.1.4 app/controllers/recruiter/users/articles_controller.rb
recruiter-0.1.3 app/controllers/recruiter/users/articles_controller.rb