Class: LesliBabel::ClonesController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /clones



43
44
45
46
47
48
49
# File 'app/controllers/lesli_babel/clones_controller.rb', line 43

def create
    
    result = TranslationsCloneService.remote_clone(clone_params[:instance_code])
    respond_with_successful if result.success?
    respond_with_error if not result.success?

end

#destroyObject

DELETE /clones/1



63
64
65
66
67
68
69
70
71
# File 'app/controllers/lesli_babel/clones_controller.rb', line 63

def destroy
    return respond_with_not_found unless @clone

    if @clone.destroy
        respond_with_successful
    else
        respond_with_error(@clone.errors.full_messages.to_sentence)
    end
end

#editObject

GET /clones/1/edit



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

def edit
end

#newObject

GET /clones/new



35
36
# File 'app/controllers/lesli_babel/clones_controller.rb', line 35

def new
end

#showObject

GET /clones/1



25
26
27
28
29
30
31
32
# File 'app/controllers/lesli_babel/clones_controller.rb', line 25

def show
    respond_to do |format|
        format.html {}
        format.json do
            return respond_with_successful()
        end
    end
end

#updateObject

PATCH/PUT /clones/1



52
53
54
55
56
57
58
59
60
# File 'app/controllers/lesli_babel/clones_controller.rb', line 52

def update
    return respond_with_not_found unless @clone

    if @clone.update(clone_params)
        respond_with_successful(@clone.show(current_user, @query))
    else
        respond_with_error(@clone.errors.full_messages.to_sentence)
    end
end