Class: EnvironmentsController
Instance Method Summary
collapse
#auto_complete_search, #invalid_search_query
#import_environments, #obsolete_and_new
#api_request?, #welcome
#clear_thread, included
Instance Method Details
#create ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'app/controllers/environments_controller.rb', line 29
def create
@environment = Environment.new(params[:environment])
if @environment.save
process_success
else
process_error
end
end
|
#destroy ⇒ Object
49
50
51
52
53
54
55
|
# File 'app/controllers/environments_controller.rb', line 49
def destroy
if @environment.destroy
process_success
else
process_error
end
end
|
#edit ⇒ Object
38
39
|
# File 'app/controllers/environments_controller.rb', line 38
def edit
end
|
#index ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# File 'app/controllers/environments_controller.rb', line 7
def index
values = Environment.search_for(params[:search], :order => params[:order])
respond_to do |format|
format.html do
@environments = values.paginate :page => params[:page]
@counter = Host.count(:group => :environment_id, :conditions => {:environment_id => @environments.all})
end
format.json { render :json => values.as_json }
end
end
|
#new ⇒ Object
25
26
27
|
# File 'app/controllers/environments_controller.rb', line 25
def new
@environment = Environment.new
end
|
#show ⇒ Object
18
19
20
21
22
23
|
# File 'app/controllers/environments_controller.rb', line 18
def show
respond_to do |format|
format.html { invalid_request }
format.json { render :json => @environment.as_json(:include => :hosts)}
end
end
|
#update ⇒ Object
41
42
43
44
45
46
47
|
# File 'app/controllers/environments_controller.rb', line 41
def update
if @environment.update_attributes(params[:environment])
process_success
else
process_error
end
end
|