Class: RatingsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RatingsController
- Defined in:
- app/controllers/ratings_controller.rb
Overview
Restful controller for Ratings
Instance Method Summary collapse
-
#create ⇒ Object
POST /ratings POST /ratings.json.
-
#destroy ⇒ Object
DELETE /ratings/1 DELETE /ratings/1.json.
-
#edit ⇒ Object
GET /ratings/1/edit.
-
#index ⇒ Object
GET /ratings GET /ratings.json.
-
#new ⇒ Object
GET /ratings/new.
-
#show ⇒ Object
GET /ratings/1 GET /ratings/1.json.
-
#update ⇒ Object
PATCH/PUT /ratings/1 PATCH/PUT /ratings/1.json.
Methods inherited from ApplicationController
#check_for_mobile, #mobile_device?
Instance Method Details
#create ⇒ Object
POST /ratings POST /ratings.json
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/ratings_controller.rb', line 30 def create @rating = Rating.new() @rating respond_to do |format| if @rating.save format.html { redirect_to @rating, notice: 'Rating was successfully created.' } format.json { render :show, status: :created, location: @rating } else format.html { render :new } format.json { render json: @rating.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /ratings/1 DELETE /ratings/1.json
60 61 62 63 64 65 66 |
# File 'app/controllers/ratings_controller.rb', line 60 def destroy @rating.destroy respond_to do |format| format.html { redirect_to , notice: 'Rating was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /ratings/1/edit
26 |
# File 'app/controllers/ratings_controller.rb', line 26 def edit() end |
#index ⇒ Object
GET /ratings GET /ratings.json
9 10 11 12 13 |
# File 'app/controllers/ratings_controller.rb', line 9 def index @ratings = Rating.all return unless params[:playbook_id] @ratings = @ratings.where(playbook_id: params[:playbook_id]) end |
#new ⇒ Object
GET /ratings/new
20 21 22 23 |
# File 'app/controllers/ratings_controller.rb', line 20 def new @rating = Rating.new @rating end |
#show ⇒ Object
GET /ratings/1 GET /ratings/1.json
17 |
# File 'app/controllers/ratings_controller.rb', line 17 def show() end |
#update ⇒ Object
PATCH/PUT /ratings/1 PATCH/PUT /ratings/1.json
46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/ratings_controller.rb', line 46 def update respond_to do |format| if @rating.update() format.html { redirect_to @rating, notice: 'Rating was successfully updated.' } format.json { render :show, status: :ok, location: @rating } else format.html { render :edit } format.json { render json: @rating.errors, status: :unprocessable_entity } end end end |