Class: SubjectHasClassificationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SubjectHasClassificationsController
- Defined in:
- app/controllers/subject_has_classifications_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /subject_has_classifications POST /subject_has_classifications.json.
-
#destroy ⇒ Object
DELETE /subject_has_classifications/1 DELETE /subject_has_classifications/1.json.
-
#edit ⇒ Object
GET /subject_has_classifications/1/edit.
-
#index ⇒ Object
GET /subject_has_classifications GET /subject_has_classifications.json.
-
#new ⇒ Object
GET /subject_has_classifications/new GET /subject_has_classifications/new.json.
-
#show ⇒ Object
GET /subject_has_classifications/1 GET /subject_has_classifications/1.json.
-
#update ⇒ Object
PUT /subject_has_classifications/1 PUT /subject_has_classifications/1.json.
Instance Method Details
#create ⇒ Object
POST /subject_has_classifications POST /subject_has_classifications.json
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/subject_has_classifications_controller.rb', line 51 def create @subject_has_classification = SubjectHasClassification.new(params[:subject_has_classification]) respond_to do |format| if @subject_has_classification.save format.html { redirect_to @subject_has_classification, :notice => t('controller.successfully_created', :model => t('activerecord.models.subject_has_classification')) } format.json { render :json => @subject_has_classification, :status => :created, :location => @subject_has_classification } else format.html { render :action => "new" } format.json { render :json => @subject_has_classification.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /subject_has_classifications/1 DELETE /subject_has_classifications/1.json
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'app/controllers/subject_has_classifications_controller.rb', line 81 def destroy @subject_has_classification.destroy respond_to do |format| format.html { if @subject redirect_to subject_subject_has_classifications_url(@subject) elsif @classification redirect_to classification_subject_has_classifications_url(@classification) else redirect_to subject_has_classifications_url end } format.json { head :no_content } end end |
#edit ⇒ Object
GET /subject_has_classifications/1/edit
46 47 |
# File 'app/controllers/subject_has_classifications_controller.rb', line 46 def edit end |
#index ⇒ Object
GET /subject_has_classifications GET /subject_has_classifications.json
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/subject_has_classifications_controller.rb', line 8 def index case when @subject @subject_has_classifications = @subject.subject_has_classifications.page(params[:page]) when @classification @subject_has_classifications = @classification.subject_has_classifications.page(params[:page]) else @subject_has_classifications = SubjectHasClassification.page(params[:page]) end respond_to do |format| format.html # index.html.erb format.json { render :json => @subject_has_classifications } end end |
#new ⇒ Object
GET /subject_has_classifications/new GET /subject_has_classifications/new.json
34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/subject_has_classifications_controller.rb', line 34 def new @subject_has_classification = SubjectHasClassification.new @subject_has_classification.subject = @subject @subject_has_classification.classification = @classification respond_to do |format| format.html # new.html.erb format.json { render :json => @subject_has_classification } end end |
#show ⇒ Object
GET /subject_has_classifications/1 GET /subject_has_classifications/1.json
25 26 27 28 29 30 |
# File 'app/controllers/subject_has_classifications_controller.rb', line 25 def show respond_to do |format| format.html # show.html.erb format.json { render :json => @subject_has_classification } end end |
#update ⇒ Object
PUT /subject_has_classifications/1 PUT /subject_has_classifications/1.json
67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/subject_has_classifications_controller.rb', line 67 def update respond_to do |format| if @subject_has_classification.update_attributes(params[:subject_has_classification]) format.html { redirect_to @subject_has_classification, :notice => t('controller.successfully_updated', :model => t('activerecord.models.subject_has_classification')) } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @subject_has_classification.errors, :status => :unprocessable_entity } end end end |