Class: LesliBabel::BucketsController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliBabel::BucketsController
- Defined in:
- app/controllers/lesli_babel/buckets_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /buckets.
-
#destroy ⇒ Object
DELETE /buckets/1.
-
#edit ⇒ Object
GET /buckets/1/edit.
-
#index ⇒ Object
GET /buckets.
-
#new ⇒ Object
GET /buckets/new.
-
#show ⇒ Object
GET /buckets/1.
-
#update ⇒ Object
PATCH/PUT /buckets/1.
Instance Method Details
#create ⇒ Object
POST /buckets
63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 63 def create bucket = Bucket.new(bucket_params) bucket.module = Module.find(params[:module_id]) bucket.reference_module = bucket.module.name if bucket.save respond_with_successful bucket else respond_with_error bucket.errors. end end |
#destroy ⇒ Object
DELETE /buckets/1
85 86 87 88 |
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 85 def destroy @bucket.destroy redirect_to buckets_url, notice: 'Bucket was successfully destroyed.' end |
#edit ⇒ Object
GET /buckets/1/edit
59 60 |
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 59 def edit end |
#index ⇒ Object
GET /buckets
38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 38 def index respond_to do |format| format.html { } format.json { respond_with_successful( Module.find(params[:module_id]).buckets.order(:code) ) } end end |
#new ⇒ Object
GET /buckets/new
54 55 56 |
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 54 def new @bucket = Bucket.new end |
#show ⇒ Object
GET /buckets/1
50 51 |
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 50 def show end |
#update ⇒ Object
PATCH/PUT /buckets/1
76 77 78 79 80 81 82 |
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 76 def update if @bucket.update(bucket_params) redirect_to @bucket, notice: 'Bucket was successfully updated.' else render :edit end end |