On 20 February 2011 11:06, Ollie <[email protected]> wrote: > Hi guys, was wondering if anyone can help me. > > I'm just starting ou so this may seem a bit mundane to some people. I > have a view which I need to display certain fields if a particular > value is selected in the database. > > The example is similar to a blog post where you may or may not want to > show a source link. So in the backend there is a tick box which is > attached to a sql boolean value then if that is ticked you can also > put the link in for the source location. > > On the front end however if the boolean is set to false I don't want > to display the data in that field. What's the best way of going about > this?
I suggest you run through some tutorials on rails and then I think the question, and many others, will likely be answered. railstutorial.org is good, and free to use online. http://railsforzombies.org/ looks like it might be fun though I have not tried it in detail. Make sure that you are using Rails 3 and that the tutorial is for Rails 3. Also have a look at the Rails Guides. To answer your question, in the view erb test the boolean and display or not as appropriate. Colin -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

