On Jan 27, 2009, at 4:06 PM, Sven wrote:

>
> On Jan 27, 3:57 pm, Rob Biedenharn <r...@agileconsultingllc.com>
> wrote:
>> Try image_url rather than image_path
>
> Sadly that method does not seem to exist (at least not in
> ActionView::Helpers::AssetTagHelper or in the Rails API docs). I wish
> it did!
>
> -Sven


So write one!  (or try this untested one)

def image_url(source)
   abs_path = image_path(source)
   unless abs_path =~ /\Ahttp/
     abs_path = "http#{'s' if https?}://#{host_with_port}/#{abs_path}"
   end
   abs_path
end

Put it in a helper such as app/helpers/application_helper.rb

-Rob

Rob Biedenharn          http://agileconsultingllc.com
r...@agileconsultingllc.com



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

Reply via email to