Class: WhurlEngine::ResourcesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/whurl_engine/resources_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
# File 'app/controllers/whurl_engine/resources_controller.rb', line 11

def create
  @resource = WhurlEngine::Resource.new(params[:resource])
  unless @resource.save
    render :partial => 'error'
  end
end

#destroyObject



29
30
31
32
33
34
# File 'app/controllers/whurl_engine/resources_controller.rb', line 29

def destroy
  @resource = WhurlEngine::Resource.find(params[:id])
  unless @resource.destroy
    render :partial => 'error'
  end
end

#editObject



18
19
20
# File 'app/controllers/whurl_engine/resources_controller.rb', line 18

def edit
  @resource = WhurlEngine::Resource.find(params[:id])
end

#newObject



7
8
9
# File 'app/controllers/whurl_engine/resources_controller.rb', line 7

def new
  @resource = WhurlEngine::Resource.new(:category_id => params[:category_id])
end

#showObject



3
4
5
# File 'app/controllers/whurl_engine/resources_controller.rb', line 3

def show
  @resource = WhurlEngine::Resource.find(params[:id])
end

#updateObject



22
23
24
25
26
27
# File 'app/controllers/whurl_engine/resources_controller.rb', line 22

def update
  @resource = WhurlEngine::Resource.find(params[:id])
  unless @resource.update_attributes(params[:resource])
    render :partial => 'error'
  end
end