class Object

Public Instance Methods

edit() click to toggle source
# File lib/sharp_admin/templates/controller.rb, line 31
def edit
end
index() click to toggle source
# File lib/sharp_admin/templates/controller.rb, line 7
  def index
    @q = <%= class_name %>.search(params[:q])
    @<%= plural_table_name %> = find_<%= plural_table_name %>
  end

<% unless options[:no_create] || options[:read_only] %>
  def new
    @<%= singular_table_name %> = <%= class_name %>.new
  end

  def create
    @<%= singular_table_name %> = <%= class_name %>.new(<%= singular_table_name %>_params)
    if @<%= singular_table_name %>.save
      redirect_to <%= options[:ns] %>_<%= plural_table_name %>_path, :notice => "Successfully created <%= human_name.downcase %>."
    else
      render :new
    end
  end
update() click to toggle source
# File lib/sharp_admin/templates/controller.rb, line 34
def update
  if @<%= singular_table_name %>.update_attributes(<%= singular_table_name %>_params)
    redirect_to <%= options[:ns] %>_<%= plural_table_name %>_path, :notice => "Successfully updated <%= human_name.downcase %>."
  else
    render :edit
  end
end