Sha256: 50d653385fc3443566c5a62bba17aa82ab4da75fb3499e14ef30126b398612f9
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require_dependency "phcpress/application_controller" module Phcpress class Articles::PostsController < ApplicationController # Filters & Security before_action :set_articles_post, only: [:show, :edit, :update, :destroy] # Article Index def index @articles_posts = Articles::Post.all end # Article Show def show end # Article New def new @articles_post = Articles::Post.new end # Article Edit def edit end # POST def create @articles_post = Articles::Post.new(articles_post_params) if @articles_post.save @articles_post.connections.build redirect_to articles_posts_url, notice: 'Post was successfully created.' else render :new end end # PATCH/PUT def update if @articles_post.update(articles_post_params) @articles_post.connections.build redirect_to articles_posts_url, notice: 'Post was successfully updated.' else render :edit end end # DELETE def destroy @articles_post.destroy redirect_to articles_posts_url, notice: 'Post was successfully destroyed.' end private # Common Callbacks def set_articles_post @articles_post = Articles::Post.find(params[:id]) end # Params Whitelist def articles_post_params params.require(:articles_post).permit(:psttitle, :psttext, :pststatus, :pstimage, :remove_pstimage, category_ids: []) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
phcpress-9.0.1 | app/controllers/phcpress/articles/posts_controller.rb |