Class: LesliBabel::BucketsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/lesli_babel/buckets_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /buckets



55
56
57
58
59
60
61
62
63
64
65
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 55

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.full_messages
    end
end

#destroyObject

DELETE /buckets/1



77
78
79
80
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 77

def destroy
    @bucket.destroy
    redirect_to buckets_url, notice: 'Bucket was successfully destroyed.'
end

#editObject

GET /buckets/1/edit



51
52
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 51

def edit
end

#indexObject

GET /buckets



38
39
40
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 38

def index
    Bucket.all
end

#newObject

GET /buckets/new



47
48
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 47

def new
end

#showObject

GET /buckets/1



43
44
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 43

def show
end

#updateObject

PATCH/PUT /buckets/1



68
69
70
71
72
73
74
# File 'app/controllers/lesli_babel/buckets_controller.rb', line 68

def update
    if @bucket.update(bucket_params)
        redirect_to @bucket, notice: 'Bucket was successfully updated.'
    else
        render :edit
    end
end