Class: SitesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/sites_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#fresh_when, #redirect_back_or_default, #redirect_referrer_or_default, #render_403, #render_404, #render_optional_error_file, #require_user, #set_active_menu, #set_locale, #set_seo_meta, #store_location, #unread_notify_count

Instance Method Details

#createObject


13
14
15
16
17
18
19
20
21
# File 'app/controllers/sites_controller.rb', line 13

def create
  @site = Site.new(site_params)
  @site.user_id = current_user.id
  if @site.save
    redirect_to(sites_path, notice: '提交成功。谢谢。')
  else
    render action: 'new'
  end
end

#indexObject


4
5
6
7
# File 'app/controllers/sites_controller.rb', line 4

def index
  @site_nodes = SiteNode.all.order(sort: :desc)
  set_seo_meta("Ruby #{t('menu.sites')}")
end

#newObject


9
10
11
# File 'app/controllers/sites_controller.rb', line 9

def new
  @site = Site.new
end