Created
December 16, 2009 15:05
-
-
Save slayer/257883 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def destroy | |
if params[:ids] | |
@models = Model.find(:all, :conditions => { :id => params[:ids] }) | |
@models.each { |m| m.destroy } | |
else | |
@model = Tracker.find(params[:id]) | |
@model.destroy | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%h1.heading | |
Listing users | |
= grid(@users_grid, :show_filters => :always) do |g| | |
- g.column :column_name => 'checkbox' | |
- g.column :column_name => 'ID', :attribute_name => 'id' | |
- g.column :column_name => 'Name', :attribute_name => 'name' | |
- g.column :column_name => 'EMail', :attribute_name => 'email' | |
- g.column do |user| | |
- link_to "Destroy", { :action => :destroy, :id => user.to_param }, :method => :delete, :confirm => "Are you sure?" | |
- g.header | |
- button_to "Delete selected", { :action => "delete" }, :confirm => "Are you sure?", :method => :delete | |
- g.footer | |
- button_to "Delete selected", { :action => "delete" }, :confirm => "Are you sure?", :method => :delete | |
OR (with header/footer columns) | |
- g.header | |
- g.column | |
- button_to "Delete selected", { :action => "delete" }, :confirm => "Are you sure?", :method => :delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment