Class: Guts::MetafieldsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Guts::MetafieldsController
- Defined in:
- app/controllers/guts/metafields_controller.rb
Overview
Metafields controller
Instance Method Summary collapse
-
#create ⇒ Object
Creates a metafield through post.
-
#destroy ⇒ Object
Destroys a single metafield.
-
#edit ⇒ Object
Editing of a metafield.
-
#index ⇒ Object
Displays a list of metafields.
-
#new ⇒ Object
Creation of a new metafield.
-
#show ⇒ Object
Shows details about a single metafield.
-
#update ⇒ Object
Updates a metafields through patch.
Methods included from SessionsHelper
#current_user, #log_in, #log_out, #logged_in?
Instance Method Details
#create ⇒ Object
Note:
Redirects to #index if successfull or re-renders #new if not
Creates a metafield through post
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/guts/metafields_controller.rb', line 21 def create @metafield = Metafield.new if @metafield.save redirect_to polymorphic_path([@object, :metafields]), notice: "Metafield was successfully created." else render :new end end |
#destroy ⇒ Object
Note:
Redirects to #index on success
Destroys a single metafield
52 53 54 55 |
# File 'app/controllers/guts/metafields_controller.rb', line 52 def destroy @metafield.destroy redirect_to polymorphic_path([@object, :metafields]), notice: "Metafield was successfully destroyed." end |
#edit ⇒ Object
Editing of a metafield
37 38 |
# File 'app/controllers/guts/metafields_controller.rb', line 37 def edit end |
#index ⇒ Object
Displays a list of metafields
10 11 12 |
# File 'app/controllers/guts/metafields_controller.rb', line 10 def index @metafields = @object. end |
#new ⇒ Object
Creation of a new metafield
15 16 17 |
# File 'app/controllers/guts/metafields_controller.rb', line 15 def new @metafield = Metafield.new end |
#show ⇒ Object
Shows details about a single metafield
32 33 |
# File 'app/controllers/guts/metafields_controller.rb', line 32 def show end |
#update ⇒ Object
Note:
Redirects to #index if successfull or re-renders #edit if not
Updates a metafields through patch
42 43 44 45 46 47 48 |
# File 'app/controllers/guts/metafields_controller.rb', line 42 def update if @metafield.update redirect_to polymorphic_path([@object, :metafields]), notice: "Metafield was successfully updated." else render :edit end end |