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 Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 26 def create @url_rewrite = UrlRewrite.new(url_rewrite_params) if @url_rewrite.save redirect_to admin_url_rewrite_path(@url_rewrite) else render :new, status: :unprocessable_content, locals: { url_rewrite: @url_rewrite } end end |
#destroy ⇒ Object
46 47 48 49 50 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 46 def destroy @url_rewrite.destroy! redirect_to admin_url_rewrites_path end |
#edit ⇒ Object
22 23 24 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 22 def edit render :edit, locals: { url_rewrite: @url_rewrite } end |
#index ⇒ Object
7 8 9 10 11 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 7 def index collection = Collection.new.with_params(params).apply(UrlRewrite.strict_loading) render locals: { collection: } end |
#new ⇒ Object
17 18 19 20 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 17 def new @url_rewrite = UrlRewrite.new render :new, locals: { url_rewrite: @url_rewrite } end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 13 def show render :show, locals: { url_rewrite: @url_rewrite } end |
#update ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/admin/url_rewrites_controller.rb', line 36 def update @url_rewrite.attributes = url_rewrite_params if @url_rewrite.save redirect_to admin_url_rewrite_path(@url_rewrite) else render :edit, status: :unprocessable_content, locals: { url_rewrite: @url_rewrite } end end |