Class: Rcms::MentionsController

Inherits:
ApplicationController show all
Defined in:
lib/generators/templates_mentions/app/controllers/rcms/mentions_controller.rb

Instance Method Summary collapse

Methods included from ApplicationController

included

Instance Method Details

#after_create_path(mention) ⇒ Object



18
19
20
# File 'lib/generators/templates_mentions/app/controllers/rcms/mentions_controller.rb', line 18

def after_create_path mention
  root_path
end

#createObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/templates_mentions/app/controllers/rcms/mentions_controller.rb', line 7

def create
  @mention = Rcms::Mention.new mention_params

  @mention.is_published = true
  if @mention.save
    redirect_to after_create_path(@mention), flash: {success: t('rcms.mentions.created')}
  else
    render :create
  end
end

#indexObject



2
3
4
5
# File 'lib/generators/templates_mentions/app/controllers/rcms/mentions_controller.rb', line 2

def index
  @news = Rcms::News.all.page(params[:page]).per(10)
  apply_meta_tags title: t('rcms.mentions.index_title')
end