Class: PagesController

Inherits:
ApplicationController
  • Object
show all
Includes:
DynamicContent
Defined in:
app/controllers/pages_controller.rb

Instance Method Summary collapse

Methods included from DynamicContent

#add_to_csv, #csv_is_empty, #csv_to_json, #exact, #find_match, #get_id_by_route, #get_last_id_from_csv, #get_row_by_route, #parse_csv, #partial, #remove_by_route, #set_dynamic_content, #update_csv_by_id

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/pages_controller.rb', line 4

def index
  set_dynamic_content('pages', request.path)

  id = @dynamic_content.id

  if id
    if @dynamic_content.redirect_to
      return redirect_to @dynamic_content.redirect_to
    end
    render 'page-' + id.to_s, layout: false

  else
    if csv_is_empty('pages')
      render 'welcome'
    else
      render '404'
    end
  end
end