Class: PushType::AssetsController
- Inherits:
-
AdminController
- Object
- ActionController::Base
- AdminController
- PushType::AssetsController
- Defined in:
- app/controllers/push_type/assets_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
- #upload ⇒ Object
Methods inherited from AdminController
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'app/controllers/push_type/assets_controller.rb', line 18 def create if @asset.save flash[:notice] = 'File successfully uploaded.' redirect_to push_type.assets_path else render 'new' end end |
#destroy ⇒ Object
43 44 45 46 47 |
# File 'app/controllers/push_type/assets_controller.rb', line 43 def destroy @asset.trash! flash[:notice] = 'Media trashed.' redirect_to push_type.assets_path end |
#edit ⇒ Object
31 32 |
# File 'app/controllers/push_type/assets_controller.rb', line 31 def edit end |
#index ⇒ Object
11 12 13 |
# File 'app/controllers/push_type/assets_controller.rb', line 11 def index @assets = PushType::Asset.not_trash.page(params[:page]) end |
#new ⇒ Object
15 16 |
# File 'app/controllers/push_type/assets_controller.rb', line 15 def new end |
#update ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/push_type/assets_controller.rb', line 34 def update if @asset.update_attributes asset_params flash[:notice] = 'Media successfully updated.' redirect_to push_type.assets_path else render 'edit' end end |
#upload ⇒ Object
27 28 29 |
# File 'app/controllers/push_type/assets_controller.rb', line 27 def upload respond_with PushType::Asset.create(asset_params).to_json, location: false end |