Re: Text Field Value unless ?

dasil003
Sat, 05 May 2007 17:19:49 -0000

You can''t have an if statement embedded in a method like this.  Not to
mention you are missing the => operator.  Try this:

<%= text_field_tag :post_header, '''', :name =>
''post[header]'', :value
=> @post.header ? @post.header : '''' %>

On May 5, 8:37 am, Jamal Soueidan
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> Hello,
>
> Why is this not working :(
>
> <%= text_field_tag :post_header, '''', :name =>
''post[header]'', :value
> @post.header if @post.header %>
>
> I want the default value to be @post.header if it''s not nil :)
>
> Thanks :D
>
> --
> Posted viahttp://www.ruby-forum.com/.