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
45 46 47 48 |
# File 'app/controllers/application_controller.rb', line 45 def create @content = Node.new node_params respond_with @content, location: -> { application_path(@content) } end |
#new ⇒ Object
> New
39 40 41 42 |
# File 'app/controllers/application_controller.rb', line 39 def new @content = Node.new respond_with @content end |
#robots ⇒ Object
61 62 63 64 |
# File 'app/controllers/application_controller.rb', line 61 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”
29 30 31 32 |
# File 'app/controllers/application_controller.rb', line 29 def show raise ActionController::RoutingError.new('Not Found') if params[:id] == "index" @content = Node.find_by_slug! params[:id] || "index" end |
#update ⇒ Object
> Update
51 52 53 54 |
# File 'app/controllers/application_controller.rb', line 51 def update @content = Node.find_by_slug! params[:id] respond_with @content, location: -> { application_path(@content) } end |