Module: Admini::Resources
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/admini/resources.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/controllers/concerns/admini/resources.rb', line 42 def create if @resource.save redirect_to action: :show, id: @resource.id else render :new end end |
#destroy ⇒ Object
64 65 66 67 |
# File 'app/controllers/concerns/admini/resources.rb', line 64 def destroy @resource.destroy redirect_to action: :index end |
#edit ⇒ Object
53 54 |
# File 'app/controllers/concerns/admini/resources.rb', line 53 def edit end |
#index ⇒ Object
33 34 35 36 37 |
# File 'app/controllers/concerns/admini/resources.rb', line 33 def index @resources = @resources.order(id: :desc) .page(params[:page]) .per(paginates_per) end |
#new ⇒ Object
39 40 |
# File 'app/controllers/concerns/admini/resources.rb', line 39 def new end |
#show ⇒ Object
50 51 |
# File 'app/controllers/concerns/admini/resources.rb', line 50 def show end |
#update ⇒ Object
56 57 58 59 60 61 62 |
# File 'app/controllers/concerns/admini/resources.rb', line 56 def update if @resource.update(resource_params) redirect_to action: :show, id: @resource.id else render :edit end end |