Class: ManifestationRelationshipsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ManifestationRelationshipsController
- Defined in:
- app/controllers/manifestation_relationships_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /manifestation_relationships POST /manifestation_relationships.json.
-
#destroy ⇒ Object
DELETE /manifestation_relationships/1 DELETE /manifestation_relationships/1.json.
-
#edit ⇒ Object
GET /manifestation_relationships/1/edit.
-
#index ⇒ Object
GET /manifestation_relationships GET /manifestation_relationships.json.
-
#new ⇒ Object
GET /manifestation_relationships/new.
-
#show ⇒ Object
GET /manifestation_relationships/1 GET /manifestation_relationships/1.json.
-
#update ⇒ Object
PUT /manifestation_relationships/1 PUT /manifestation_relationships/1.json.
Instance Method Details
#create ⇒ Object
POST /manifestation_relationships POST /manifestation_relationships.json
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/manifestation_relationships_controller.rb', line 49 def create @manifestation_relationship = ManifestationRelationship.new(manifestation_relationship_params) respond_to do |format| if @manifestation_relationship.save format.html { redirect_to @manifestation_relationship, notice: t('controller.successfully_created', model: t('activerecord.models.manifestation_relationship')) } format.json { render json: @manifestation_relationship, status: :created, location: @manifestation_relationship } else format.html { render action: "new" } format.json { render json: @manifestation_relationship.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /manifestation_relationships/1 DELETE /manifestation_relationships/1.json
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'app/controllers/manifestation_relationships_controller.rb', line 88 def destroy @manifestation_relationship.destroy respond_to do |format| format.html { flash[:notice] = t('controller.successfully_deleted', model: t('activerecord.models.manifestation_relationship')) if @manifestation redirect_to manifestations_url(manifestation_id: @manifestation.id) else redirect_to manifestation_relationships_url end } format.json { head :no_content } end end |
#edit ⇒ Object
GET /manifestation_relationships/1/edit
44 45 |
# File 'app/controllers/manifestation_relationships_controller.rb', line 44 def edit end |
#index ⇒ Object
GET /manifestation_relationships GET /manifestation_relationships.json
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/manifestation_relationships_controller.rb', line 9 def index case when @manifestation @manifestation_relationships = @manifestation.manifestation_relationships.order('manifestation_relationships.position').page(params[:page]) else @manifestation_relationships = ManifestationRelationship.page(params[:page]) end respond_to do |format| format.html # index.html.erb format.json { render json: @manifestation_relationships } end end |
#new ⇒ Object
GET /manifestation_relationships/new
33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/manifestation_relationships_controller.rb', line 33 def new if @manifestation.blank? redirect_to manifestations_url return else @manifestation_relationship = ManifestationRelationship.new @manifestation_relationship.manifestation = @manifestation end end |
#show ⇒ Object
GET /manifestation_relationships/1 GET /manifestation_relationships/1.json
25 26 27 28 29 30 |
# File 'app/controllers/manifestation_relationships_controller.rb', line 25 def show respond_to do |format| format.html # show.html.erb format.json { render json: @manifestation_relationship } end end |
#update ⇒ Object
PUT /manifestation_relationships/1 PUT /manifestation_relationships/1.json
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/controllers/manifestation_relationships_controller.rb', line 66 def update # 並べ替え if @manifestation && params[:move] move_position(@manifestation_relationship, params[:move], false) redirect_to manifestation_relationships_url(manifestation_id: @manifestation_relationship.parent_id) return end respond_to do |format| if @manifestation_relationship.update(manifestation_relationship_params) format.html { redirect_to @manifestation_relationship, notice: t('controller.successfully_updated', model: t('activerecord.models.manifestation_relationship')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @manifestation_relationship.errors, status: :unprocessable_entity } end end end |