You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This looks great but it relies on the <%= ... %> construction for th and td elements to be displayed.
If you move the example code into a helper, e.g.
def example
@front_men = [FrontMan.new(1, 'David St. Hubbins'), FrontMan.new(2, 'David Lee Roth')]
table_for(@front_men) do |t|
t.head do
t.r do
t.h('Id')
t.h('Name')
end
end
t.body do |front_man|
t.r do
t.d(h(front_man.id))
t.d(h(front_man.name))
end
end
end
end
The output will include the table and tr tags, but it won't have any content. Passing the content in as a block has the same effect.
Also, for some reason, when the helper method example() is invoked from the .html.erb file, the contents of both are duplicated (my h1 followed by my table, followed by my h1 followed by my table). I believe this is caused by table_helper, because when I replace the table_for() call in example() with a regular old content_tag(), the duplication does not occur.
The text was updated successfully, but these errors were encountered:
This looks great but it relies on the <%= ... %> construction for th and td elements to be displayed.
If you move the example code into a helper, e.g.
The output will include the table and tr tags, but it won't have any content. Passing the content in as a block has the same effect.
Also, for some reason, when the helper method example() is invoked from the .html.erb file, the contents of both are duplicated (my h1 followed by my table, followed by my h1 followed by my table). I believe this is caused by table_helper, because when I replace the table_for() call in example() with a regular old content_tag(), the duplication does not occur.
The text was updated successfully, but these errors were encountered: