Class: Manage::ResourceController

Inherits:
ApplicationController show all
Defined in:
app/controllers/manage/resource_controller.rb

Direct Known Subclasses

AdminUsersController

Instance Method Summary collapse

Methods inherited from ApplicationController

#auth_user!, #current_user

Instance Method Details

#createObject



30
31
32
33
34
35
# File 'app/controllers/manage/resource_controller.rb', line 30

def create
  create!(:notice => "New #{resource_class} created!") do |success, failure|
    success.html { redirect_to action: :index }
    failure.html { render :action => :edit and return }
  end
end

#destroyObject



44
45
46
47
48
# File 'app/controllers/manage/resource_controller.rb', line 44

def destroy
  destroy!(:notice => "#{resource_class} deleted!") do |format|
    format.html { redirect_to action: :index }
  end
end

#end_of_association_chainObject



20
21
22
23
24
25
26
27
28
# File 'app/controllers/manage/resource_controller.rb', line 20

def end_of_association_chain
  if self.resources_configuration[:self][:search_fields].blank?
    self.class.search_fields :all
  end

  config = self.resources_configuration[:self]
  @search = config[:search].new(filters: clean_search_params(params[:f]))
  @search.results
end

#show_helpObject



50
51
# File 'app/controllers/manage/resource_controller.rb', line 50

def show_help
end

#updateObject



37
38
39
40
41
42
# File 'app/controllers/manage/resource_controller.rb', line 37

def update
  update!(:notice => "#{resource_class} updated!") do |success, failure|
    success.html { redirect_to action: :index }
    failure.html { render :action => :edit and return }
  end
end