Class: DatatableState::StoreController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- DatatableState::StoreController
- Defined in:
- app/controllers/datatable_state/store_controller.rb
Instance Method Summary collapse
Instance Method Details
#load ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/datatable_state/store_controller.rb', line 25 def load result = if @store @store.state else {}.as_json end respond_with result end |
#save ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/datatable_state/store_controller.rb', line 8 def save if @store @store.update_attributes(params[:datatable_state]) else @store = Store.new(params[:datatable_state]) @store.user = current_user end respond_to do |format| if @store.save format.json { render json: @store, status: :created } else format.json { render json: @store.errors, status: :unprocessable_entity } end end end |