Alan C Francis
2006-Jan-05 13:32 UTC
[Rails] Re: help with link_to_if, I can''t make it work..
Nooby guess, Do you need a comma between comment.web_site and {"class... ? Looks like there should be 4 params...test, text, href and html_params A. On 4 Jan 2006, at 04:42, rails-request@lists.rubyonrails.org wrote:> Date: Wed, 4 Jan 2006 05:05:39 +0100 > From: charlie bowman <cbowmanschool@yahoo.com> > Subject: [Rails] Re: help with link_to_if, I can''t make it work... > To: rails@lists.rubyonrails.org > Message-ID: <3b2a53e1cd0cc426350c06ff42fa5c3c@ruby-forum.com> > Content-Type: text/plain; charset=utf-8 > > has anyone else tried to use link_to_if? > > > charlie bowman wrote: >> For the life of me I can''t get it to work. Here is an example of my >> syntax. I''m trying to make comment.name a link to >> comment.web_site only >> if there is a comment.web_site. Can someone please help? >> >> <%= link_to_if(comment.web_site.length > 0, comment.name, >> comment.web_site {"class" => "comment_by"}) %> > > > -- > Posted via http://www.ruby-forum.com/.-- mailto:alancfrancis@gmail.com http://blog.alancfrancis.com/