Daniel Scrima wrote:> I have a database that is reading the "show_times" from a column
in my
> database table, but nothing is showing up. Is there some sort of
> syntax error here? I thought this was working fine yesterday...
>
>
> <% @show_times.each do |s| %>
> <br/>
> <%= link_to s.show_time, :controller => "movies",
:action =>
> "detail", :id => s %>
> <% end %>
>
>
> Thanks for any help
Hey daniel -
if the loop isn''t rendering anything, but there is no error either -
one
of two options is the case:
either 1) @show_times is an empty array
# @show_times.inspect ==> []
or 2) a show_time instance with the show_time method returns an
empty string
# s.show_time => ""
that''s my guess.
the best thing to do, as a first debugging step is to use #inspect -
great debugging tool. just do:
@show_times.inspect in the rhtml (or in the action in the controller
do render_text @show_times.inspect on the last line)
and see what it comes up with. i find this very useful.
good luck!
-shai
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---