Class: Cmtool::YmlFilesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/cmtool/yml_files_controller.rb

Instance Method Summary collapse

Methods included from ControllerGlue

#cmtool_user

Instance Method Details

#createObject

POST /yml_files POST /yml_files.xml



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/cmtool/yml_files_controller.rb', line 43

def create
  @yml_file = Cmtool::YmlFile.new(yml_file_params)

  respond_to do |format|
    if @yml_file.save
      format.html { redirect_to(cmtool.yml_files_path, :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::YmlFile.model_name.human)) }
      format.xml  { render :xml => @yml_file, :status => :created, :location => @yml_file }
    else
      format.html { render :action => "new" }
      format.xml  { render :xml => @yml_file.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /yml_files/1 DELETE /yml_files/1.xml



75
76
77
78
79
80
81
82
83
# File 'app/controllers/cmtool/yml_files_controller.rb', line 75

def destroy
  @yml_file = Cmtool::YmlFile.find(params[:id])
  @yml_file.destroy

  respond_to do |format|
    format.html { redirect_to(cmtool.yml_files_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::YmlFile.model_name.human)) }
    format.xml  { head :ok }
  end
end

#editObject

GET /yml_files/1/edit



37
38
39
# File 'app/controllers/cmtool/yml_files_controller.rb', line 37

def edit
  @yml_file = Cmtool::YmlFile.find(params[:id])
end

#indexObject

GET /yml_files GET /yml_files.xml



5
6
7
8
9
10
11
12
# File 'app/controllers/cmtool/yml_files_controller.rb', line 5

def index
  @yml_files = Cmtool::YmlFile.all

  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml => @yml_files }
  end
end

#newObject

GET /yml_files/new GET /yml_files/new.xml



27
28
29
30
31
32
33
34
# File 'app/controllers/cmtool/yml_files_controller.rb', line 27

def new
  @yml_file = Cmtool::YmlFile.new

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @yml_file }
  end
end

#showObject

GET /yml_files/1 GET /yml_files/1.xml



16
17
18
19
20
21
22
23
# File 'app/controllers/cmtool/yml_files_controller.rb', line 16

def show
  @yml_file = Cmtool::YmlFile.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb
    format.xml  { render :xml => @yml_file }
  end
end

#updateObject

PUT /yml_files/1 PUT /yml_files/1.xml



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'app/controllers/cmtool/yml_files_controller.rb', line 59

def update
  @yml_file = Cmtool::YmlFile.find(params[:id])

  respond_to do |format|
    if @yml_file.update_attributes(yml_file_params)
      format.html { redirect_to(cmtool.yml_files_path, :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::YmlFile.model_name.human)) }
      format.xml  { head :ok }
    else
      format.html { render :action => "edit" }
      format.xml  { render :xml => @yml_file.errors, :status => :unprocessable_entity }
    end
  end
end