Class: Ninetails::SectionsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
# File 'app/controllers/ninetails/sections_controller.rb', line 4

def index
  sections = Dir.glob(Rails.root.join("app", "components", "section", "*.rb")).collect do |entry|
    empty_section_from_name File.basename(entry, ".rb")
  end

  render json: { sections: sections }
end

#showObject



12
13
14
# File 'app/controllers/ninetails/sections_controller.rb', line 12

def show
  render json: empty_section_from_name(params[:id])
end

#validateObject



16
17
18
19
20
21
22
# File 'app/controllers/ninetails/sections_controller.rb', line 16

def validate
  @section = Ninetails::PageSection.new section_params

  unless @section.valid?
    render status: :bad_request
  end
end