Class: ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ApplicationController
- Defined in:
- app/controllers/application_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
> Create.
-
#new ⇒ Object
> New.
- #robots ⇒ Object
-
#show ⇒ Object
> Specific page content => All slugrouter requests passed here (including root) => Liquid ref - github.com/Shopify/liquid/wiki/Liquid-for-Programmers#first-steps => If not using bang operator in find, use || “No Content”.
-
#update ⇒ Object
> Update.
Instance Method Details
#create ⇒ Object
> Create
42 43 44 45 |
# File 'app/controllers/application_controller.rb', line 42 def create @content = Node.new node_params respond_with @content, location: -> { application_path(@content) } end |
#new ⇒ Object
> New
36 37 38 39 |
# File 'app/controllers/application_controller.rb', line 36 def new @content = Node.new respond_with @content end |
#robots ⇒ Object
58 59 60 61 |
# File 'app/controllers/application_controller.rb', line 58 def robots expires_in 5.hours, public: true render plain: "User-agent: *" end |
#show ⇒ Object
> Specific page content
> All slugrouter requests passed here (including root)
> Liquid ref - github.com/Shopify/liquid/wiki/Liquid-for-Programmers#first-steps
> If not using bang operator in find, use || “No Content”
26 27 28 29 |
# File 'app/controllers/application_controller.rb', line 26 def show raise ActionController::RoutingError.new('Not Found') if params[:id] == "index" @content = Node.find_by_slug! params[:id] || "index" end |
#update ⇒ Object
> Update
48 49 50 51 |
# File 'app/controllers/application_controller.rb', line 48 def update @content = Node.find_by_slug! params[:id] respond_with @content, location: -> { application_path(@content) } end |