Skip to content

Instantly share code, notes, and snippets.

@wildjcrt
Created March 16, 2010 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wildjcrt/333676 to your computer and use it in GitHub Desktop.
Save wildjcrt/333676 to your computer and use it in GitHub Desktop.
<%= render_table(@games,
[
["ID", lambda { |p| p.id }],
["遊戲名稱", lambda { |p| p.name }],
["標籤", lambda { |p| p.tag_list.join(" | ") }],
["動作", lambda { |p| index_table(p)}]
],
:class_name => "table")
%>
helper:
def index_table(game)
str = ""
str += link_to("Show", game_path(game))
if current_user
str +="" + ' | ' +
add_to_favorites_status_bar(game) + ' | ' +
link_to("Edit", edit_game_path(game)) + ' | ' +
link_to("Delete", game_path(game), :confirm => "Are you sure?", :method => :delete )
end
return str
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment