Topic: quick button_to question

Can I use the button_to helper to specify an image instead of a forum button to click on?  I've been googling a while now and saw a trac that passed :type => "image", :src => "something.gif" as an html option.  I've tried doing that and it didn't work.

Edit:

Also, is there an Ajax helper equivalent?

Last edited by circuitshaman (2006-08-14 16:10:56)

If art interprets our dreams, the computer executes them in the guise of programs.

-SICP (Abelson, Sussman)

Re: quick button_to question

Can I ask why you would do this and not just create an image with a link around it?

Re: quick button_to question

It's linking to a destroy action.  I'd love to use link_to_image but wouldn't like to have a spider destroy my database.

If art interprets our dreams, the computer executes them in the guise of programs.

-SICP (Abelson, Sussman)

Re: quick button_to question

Ah I see. Looking at the button_to method I see

html_options.merge!("type" => "submit", "value" => name)

meaning it will always overwrite type => 'image' with submit.

I would just create my own 'image_to' helper.

Last edited by thabenksta (2006-08-14 17:28:14)

Re: quick button_to question

Or you could place an image tag in link_to with the :post => true option. There's an example in the docs (just without :post => true).

Railscasts - Free Ruby on Rails Screencasts

Re: quick button_to question

Interesting, it says the form is dynamically added through javascript. All kinds of little stuff like that lying around.