Class: Cloudstrg::RemoteobjectsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/cloudstrg/remoteobjects_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /remoteobjects POST /remoteobjects.json



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/controllers/cloudstrg/remoteobjects_controller.rb', line 49

def create
  @remoteobject = Remoteobject.new(params[:remoteobject])
  
  respond_to do |format|
    if @remoteobject.save
      format.html { redirect_to @remoteobject, notice: 'Remoteobject was successfully created.' }
      format.json { render json: @remoteobject, status: :created, location: @remoteobject }
    else
      format.html { render action: "new" }
      format.json { render json: @remoteobject.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /remoteobjects/1 DELETE /remoteobjects/1.json



81
82
83
84
85
86
87
88
89
# File 'app/controllers/cloudstrg/remoteobjects_controller.rb', line 81

def destroy
  @remoteobject = Remoteobject.find(params[:id])
  @remoteobject.destroy
  
  respond_to do |format|
    format.html { redirect_to remoteobjects_url }
    format.json { head :no_content }
  end
end

#editObject

GET /remoteobjects/1/edit



43
44
45
# File 'app/controllers/cloudstrg/remoteobjects_controller.rb', line 43

def edit
  @remoteobject = Remoteobject.find(params[:id])
end

#indexObject

GET /remoteobjects GET /remoteobjects.json



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/cloudstrg/remoteobjects_controller.rb', line 7

def index
  if params.has_key? :plugin_id
    @remoteobjects = Remoteobject.where :plugin_id => params[:plugin_id]
  else
    @remoteobjects = Remoteobject.all
  end
  
  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @remoteobjects }
  end
end

#newObject

GET /remoteobjects/new GET /remoteobjects/new.json



33
34
35
36
37
38
39
40
# File 'app/controllers/cloudstrg/remoteobjects_controller.rb', line 33

def new
  @remoteobject = Remoteobject.new
  
  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @remoteobject }
  end
end

#showObject

GET /remoteobjects/1 GET /remoteobjects/1.json



22
23
24
25
26
27
28
29
# File 'app/controllers/cloudstrg/remoteobjects_controller.rb', line 22

def show
  @remoteobject = Remoteobject.find(params[:id])
  
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @remoteobject }
  end
end

#updateObject

PUT /remoteobjects/1 PUT /remoteobjects/1.json



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'app/controllers/cloudstrg/remoteobjects_controller.rb', line 65

def update
  @remoteobject = Remoteobject.find(params[:id])
  
  respond_to do |format|
    if @remoteobject.update_attributes(params[:remoteobject])
      format.html { redirect_to @remoteobject, notice: 'Remoteobject was successfully updated.' }
      format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @remoteobject.errors, status: :unprocessable_entity }
    end
  end
end