Class: InventoryFilesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/inventory_files_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /inventory_files POST /inventory_files.json



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/controllers/inventory_files_controller.rb', line 41

def create
  @inventory_file = InventoryFile.new(params[:inventory_file])
  @inventory_file.user = current_user

  respond_to do |format|
    if @inventory_file.save
      flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.inventory_file'))
      @inventory_file.import
      format.html { redirect_to(@inventory_file) }
      format.json { render :json => @inventory_file, :status => :created, :location => @inventory_file }
    else
      format.html { render :action => "new" }
      format.json { render :json => @inventory_file.errors, :status => :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /inventory_files/1 DELETE /inventory_files/1.json



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

def destroy
  @inventory_file.destroy

  respond_to do |format|
    format.html { redirect_to inventory_files_url }
    format.json { head :no_content }
  end
end

#editObject

GET /inventory_files/1/edit



36
37
# File 'app/controllers/inventory_files_controller.rb', line 36

def edit
end

#indexObject

GET /inventory_files GET /inventory_files.json



6
7
8
9
10
11
12
13
# File 'app/controllers/inventory_files_controller.rb', line 6

def index
  @inventory_files = InventoryFile.page(params[:page])

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

#newObject

GET /inventory_files/new GET /inventory_files/new.json



26
27
28
29
30
31
32
33
# File 'app/controllers/inventory_files_controller.rb', line 26

def new
  @inventory_file = InventoryFile.new

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

#showObject

GET /inventory_files/1 GET /inventory_files/1.json



17
18
19
20
21
22
# File 'app/controllers/inventory_files_controller.rb', line 17

def show
  respond_to do |format|
    format.html # show.html.erb
    format.json { render :json => @inventory_file }
  end
end

#updateObject

PUT /inventory_files/1 PUT /inventory_files/1.json



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

def update
  respond_to do |format|
    if @inventory_file.update_attributes(params[:inventory_file])
      flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.inventory_file'))
      format.html { redirect_to(@inventory_file) }
      format.json { head :no_content }
    else
      format.html { render :action => "edit" }
      format.json { render :json => @inventory_file.errors, :status => :unprocessable_entity }
    end
  end
end