Class: BookstoresController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- BookstoresController
- Defined in:
- app/controllers/bookstores_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /bookstores POST /bookstores.json.
-
#destroy ⇒ Object
DELETE /bookstores/1 DELETE /bookstores/1.json.
-
#edit ⇒ Object
GET /bookstores/1/edit.
-
#index ⇒ Object
GET /bookstores GET /bookstores.json.
-
#new ⇒ Object
GET /bookstores/new GET /bookstores/new.json.
-
#show ⇒ Object
GET /bookstores/1 GET /bookstores/1.json.
-
#update ⇒ Object
PUT /bookstores/1 PUT /bookstores/1.json.
Instance Method Details
#create ⇒ Object
POST /bookstores POST /bookstores.json
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/bookstores_controller.rb', line 40 def create @bookstore = Bookstore.new(bookstore_params) respond_to do |format| if @bookstore.save format.html { redirect_to @bookstore, notice: t('controller.successfully_created', model: t('activerecord.models.bookstore')) } format.json { render json: @bookstore, status: :created, location: @bookstore } else format.html { render action: "new" } format.json { render json: @bookstore.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /bookstores/1 DELETE /bookstores/1.json
75 76 77 78 79 80 81 82 |
# File 'app/controllers/bookstores_controller.rb', line 75 def destroy @bookstore.destroy respond_to do |format| format.html { redirect_to bookstores_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.bookstore')) } format.json { head :no_content } end end |
#edit ⇒ Object
GET /bookstores/1/edit
35 36 |
# File 'app/controllers/bookstores_controller.rb', line 35 def edit end |
#index ⇒ Object
GET /bookstores GET /bookstores.json
5 6 7 8 9 10 11 12 |
# File 'app/controllers/bookstores_controller.rb', line 5 def index @bookstores = Bookstore.page(params[:page]) respond_to do |format| format.html # index.html.erb format.json { render json: @bookstores } end end |
#new ⇒ Object
GET /bookstores/new GET /bookstores/new.json
25 26 27 28 29 30 31 32 |
# File 'app/controllers/bookstores_controller.rb', line 25 def new @bookstore = Bookstore.new respond_to do |format| format.html # new.html.erb format.json { render json: @bookstore } end end |
#show ⇒ Object
GET /bookstores/1 GET /bookstores/1.json
16 17 18 19 20 21 |
# File 'app/controllers/bookstores_controller.rb', line 16 def show respond_to do |format| format.html # show.html.erb format.json { render json: @bookstore } end end |
#update ⇒ Object
PUT /bookstores/1 PUT /bookstores/1.json
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/controllers/bookstores_controller.rb', line 56 def update if params[:move] move_position(@bookstore, params[:move]) return end respond_to do |format| if @bookstore.update_attributes(bookstore_params) format.html { redirect_to @bookstore, notice: t('controller.successfully_updated', model: t('activerecord.models.bookstore')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @bookstore.errors, status: :unprocessable_entity } end end end |