rubyonrailsin

A Ruby and Rails talk

Saturday, March 20, 2010


[Rails] Re: Displaying an image in a Rails form_for

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Hi Joshua,

Thanks for your response.

> Can you not use an <%= image_tag("DownArrow.jpg") %>

Yes. That's essentially what I wound up with:
<%= image_tag "DownArrow.jpg" %>

My problem was that I had tried <%= f.image_tag "DownArrow.jpg" %> and
then
<%= f.image "DownArrow.jpg" %>. Colin pointed out the plain image_tag
without the "f."
is what I needed.

Best wishes,
Richard

On Mar 20, 3:02 pm, Joshua Martin <josmar52...@gmail.com> wrote:
> Can you not use an <%= image_tag("DownArrow.jpg") %> ?
>
> On Mar 20, 2:29 pm, RichardOnRails
>
> <RichardDummyMailbox58...@USComputerGurus.com> wrote:
> > Hi,
>
> > I've got a public\images\DownArrow.jpg
> > and app\views\expenses\new.html.erb that want to present this image in
> > the following context:
>
> >   <p>
> >     <%= f.label :vendor %><br />
> >     <%= f.text_field :vendor %>
> >     <%= f.image "DownArrow.jpg" %>
> >     <br>
> >     <%= select_tag "test",
> >           options_for_select(@current_vendors.collect { |v| v.nickname }),
> >           {:multiple => true} %>
> >   </p>
>
> > But Rails gushes the unforgiving response:
> > undefined method `image' for #<ActionView::Helpers::FormBuilder:
> > 0x48194e0>
>
> > I couldn't find anything helpful in:
> > --http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html
> > --http://api.rubyonrails.org/http://api.rubyonrails.org/
> > -- Google
>
> > Any ideas?
>
> > Thanks in Advance,
> > Richard

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive