Class: Admin::UrlRewritesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Admin::UrlRewritesController
- Defined in:
- app/controllers/admin/url_rewrites_controller.rb
Defined Under Namespace
Classes: Collection
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#url_rewrite ⇒ Object
readonly
Returns the value of attribute url_rewrite.
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
7 8 9 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 7 def collection @collection end |
#url_rewrite ⇒ Object (readonly)
Returns the value of attribute url_rewrite.
7 8 9 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 7 def url_rewrite @url_rewrite end |
Instance Method Details
#create ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 29 def create @url_rewrite = UrlRewrite.new(url_rewrite_params) if @url_rewrite.save redirect_to admin_url_rewrite_path(url_rewrite), status: :see_other else render :new, locals: { url_rewrite: }, status: :unprocessable_content end end |
#destroy ⇒ Object
47 48 49 50 51 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 47 def destroy @url_rewrite.destroy! redirect_to admin_url_rewrites_path, status: :see_other end |
#edit ⇒ Object
25 26 27 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 25 def edit render locals: { url_rewrite: } end |
#index ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 9 def index @collection = Collection.new.with_params(params).apply(UrlRewrite.strict_loading.all) render locals: { collection: } end |
#new ⇒ Object
19 20 21 22 23 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 19 def new @url_rewrite = UrlRewrite.new render locals: { url_rewrite: } end |
#show ⇒ Object
15 16 17 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 15 def show render locals: { url_rewrite: } end |
#update ⇒ Object
39 40 41 42 43 44 45 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 39 def update if url_rewrite.update(url_rewrite_params) redirect_to admin_url_rewrite_path(url_rewrite), status: :see_other else render :edit, locals: { url_rewrite: }, status: :unprocessable_content end end |