Class: PagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PagesController
- Defined in:
- lib/generators/lean_cms/demo/templates/pages_controller.rb
Instance Method Summary collapse
Instance Method Details
#about ⇒ Object
10 11 12 |
# File 'lib/generators/lean_cms/demo/templates/pages_controller.rb', line 10 def about @page = LeanCms::Page.find_by(slug: 'about') end |
#contact ⇒ Object
14 15 16 |
# File 'lib/generators/lean_cms/demo/templates/pages_controller.rb', line 14 def contact @page = LeanCms::Page.find_by(slug: 'contact') end |
#home ⇒ Object
6 7 8 |
# File 'lib/generators/lean_cms/demo/templates/pages_controller.rb', line 6 def home @page = LeanCms::Page.find_by(slug: 'home') end |
#submit_contact ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/generators/lean_cms/demo/templates/pages_controller.rb', line 18 def submit_contact LeanCms::FormSubmission.create!( name: params[:name], email: params[:email], message: params[:message] ) redirect_to contact_path, notice: "Message sent!" rescue ActiveRecord::RecordInvalid => e flash.now[:alert] = e. @page = LeanCms::Page.find_by(slug: 'contact') render :contact, status: :unprocessable_entity end |