Class: Banal::BrainstormsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Banal::BrainstormsController
- Defined in:
- app/controllers/banal/brainstorms_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /banal/brainstorms POST /banal/brainstorms.json.
-
#destroy ⇒ Object
DELETE /banal/brainstorms/1 DELETE /banal/brainstorms/1.json.
-
#edit ⇒ Object
GET /banal/brainstorms/1/edit.
-
#index ⇒ Object
GET /banal/brainstorms GET /banal/brainstorms.json.
- #make_project ⇒ Object
-
#new ⇒ Object
GET /banal/brainstorms/new.
-
#show ⇒ Object
GET /banal/brainstorms/1 GET /banal/brainstorms/1.json.
-
#update ⇒ Object
PATCH/PUT /banal/brainstorms/1 PATCH/PUT /banal/brainstorms/1.json.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /banal/brainstorms POST /banal/brainstorms.json
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/banal/brainstorms_controller.rb', line 32 def create @banal_brainstorm = Banal::Brainstorm.new(banal_brainstorm_params) respond_to do |format| if @banal_brainstorm.save format.html { redirect_to @banal_brainstorm, notice: 'Brainstorm was successfully created.' } format.json { render :show, status: :created, location: @banal_brainstorm } else format.html { render :new } format.json { render json: @banal_brainstorm.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /banal/brainstorms/1 DELETE /banal/brainstorms/1.json
76 77 78 79 80 81 82 |
# File 'app/controllers/banal/brainstorms_controller.rb', line 76 def destroy @banal_brainstorm.destroy respond_to do |format| format.html { redirect_to banal_brainstorms_url, notice: 'Brainstorm was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /banal/brainstorms/1/edit
27 28 |
# File 'app/controllers/banal/brainstorms_controller.rb', line 27 def edit end |
#index ⇒ Object
GET /banal/brainstorms GET /banal/brainstorms.json
6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/banal/brainstorms_controller.rb', line 6 def index banal_brainstorms = Banal::Brainstorm if params[:only_killed] banal_brainstorms = banal_brainstorms.only_deleted end @banal_brainstorms = banal_brainstorms.all end |
#make_project ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/banal/brainstorms_controller.rb', line 60 def make_project ActiveRecord::Base.transaction do project = Banal::Project.create!( @banal_brainstorm .attributes .except('idea', 'deleted_at', 'id') .merge({name: @banal_brainstorm.idea})) @banal_brainstorm.destroy_fully! redirect_to(banal_project_path(project.id)) end end |
#new ⇒ Object
GET /banal/brainstorms/new
22 23 24 |
# File 'app/controllers/banal/brainstorms_controller.rb', line 22 def new @banal_brainstorm = Banal::Brainstorm.new end |
#show ⇒ Object
GET /banal/brainstorms/1 GET /banal/brainstorms/1.json
18 19 |
# File 'app/controllers/banal/brainstorms_controller.rb', line 18 def show end |
#update ⇒ Object
PATCH/PUT /banal/brainstorms/1 PATCH/PUT /banal/brainstorms/1.json
48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/banal/brainstorms_controller.rb', line 48 def update respond_to do |format| if @banal_brainstorm.update(banal_brainstorm_params) format.html { redirect_to @banal_brainstorm, notice: 'Brainstorm was successfully updated.' } format.json { render :show, status: :ok, location: @banal_brainstorm } else format.html { render :edit } format.json { render json: @banal_brainstorm.errors, status: :unprocessable_entity } end end end |