Euan Leslie wrote in post #1174549:
> This could possibly be a really stupid question, but I have a home page
> which calls a partial to show the latest entry in a table called 'news'.
> All I want to know is how to put the 'news.content' into a text box.
> Partial is as follows:
>
> <p>
> <strong>Title:</strong>
> <%= news.title %>
>
> </p>
>
> <p>
> <strong>Details:</strong>
> <%= news.content %>
> </p>
>
>
> The bit that calls this on my home page is as such:
>
> <%= render partial: 'news/news', locals: { news: News.last } %>.
Hi again
I've found another problem with this. It produces an error if there are
no records in the table.
The line in my Index view:
<%= render partial: 'news/news', locals: { news: News.last } %>
Can I make it just shows a blank entry if there is no record?
--
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/e5f7b88d6791836bd9b324ebe4e31bdb%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.