<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: image_url function in Ruby on Rails</title>
	<atom:link href="http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/</link>
	<description>All composite phenomena are impermanent. All contaminated things and events are unsatisfactory.</description>
	<lastBuildDate>Mon, 23 Jan 2012 17:06:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: lulalala</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/comment-page-1/#comment-39265</link>
		<dc:creator>lulalala</dc:creator>
		<pubDate>Thu, 22 Dec 2011 10:04:51 +0000</pubDate>
		<guid isPermaLink="false">http://stick.gk2.sk/?p=997#comment-39265</guid>
		<description>Just to add: This will not work with delayed jobs as request will be empty, so one probably need to use root_url instead of request.host</description>
		<content:encoded><![CDATA[<p>Just to add: This will not work with delayed jobs as request will be empty, so one probably need to use root_url instead of request.host</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lulalala</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/comment-page-1/#comment-39263</link>
		<dc:creator>lulalala</dc:creator>
		<pubDate>Thu, 22 Dec 2011 09:16:58 +0000</pubDate>
		<guid isPermaLink="false">http://stick.gk2.sk/?p=997#comment-39263</guid>
		<description>&lt;a href=&quot;#comment-15677&quot; rel=&quot;nofollow&quot;&gt;@Jay &lt;/a&gt; 
helper :application</description>
		<content:encoded><![CDATA[<p><a href="#comment-15677" rel="nofollow">@Jay </a><br />
helper :application</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cc-web.eu</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/comment-page-1/#comment-28611</link>
		<dc:creator>cc-web.eu</dc:creator>
		<pubDate>Wed, 27 Apr 2011 09:22:10 +0000</pubDate>
		<guid isPermaLink="false">http://stick.gk2.sk/?p=997#comment-28611</guid>
		<description>just another version for simple image_url (works in email-templates too) :) 

def image_url(source)
 &quot;#{root_url}#{image_path(source)}&quot; 
end</description>
		<content:encoded><![CDATA[<p>just another version for simple image_url (works in email-templates too) <img src='http://stick.gk2.sk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>def image_url(source)<br />
 &#8220;#{root_url}#{image_path(source)}&#8221;<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Schuh</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/comment-page-1/#comment-22557</link>
		<dc:creator>Peter Schuh</dc:creator>
		<pubDate>Fri, 31 Dec 2010 16:11:43 +0000</pubDate>
		<guid isPermaLink="false">http://stick.gk2.sk/?p=997#comment-22557</guid>
		<description>Just what I was looking for. (Though I don&#039;t understand why it&#039;s not baked into Rails.)

Thanks!</description>
		<content:encoded><![CDATA[<p>Just what I was looking for. (Though I don&#8217;t understand why it&#8217;s not baked into Rails.)</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aymeric</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/comment-page-1/#comment-16790</link>
		<dc:creator>Aymeric</dc:creator>
		<pubDate>Wed, 11 Aug 2010 09:38:38 +0000</pubDate>
		<guid isPermaLink="false">http://stick.gk2.sk/?p=997#comment-16790</guid>
		<description>Thanks for this nice snippet! I knew someone must have written it :)</description>
		<content:encoded><![CDATA[<p>Thanks for this nice snippet! I knew someone must have written it <img src='http://stick.gk2.sk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/comment-page-1/#comment-15677</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Wed, 16 Jun 2010 09:44:33 +0000</pubDate>
		<guid isPermaLink="false">http://stick.gk2.sk/?p=997#comment-15677</guid>
		<description>Could you help me please? I cannot use this in email layout, somehow...

in application_helper.rb I have
 def image_url(source)
   abs_path = image_path(source)
   unless abs_path =~ /^http/
     abs_path = &quot;#{request.protocol}#{request.host_with_port}#{abs_path}&quot;
   end
   abs_path
 end
and in my email model (order_mailer.rb) I have
class OrderMailer &lt; ActionMailer::Base
 layout &#039;emails&#039;
 . . .
end

but when I use  I get
undefined method `image_url&#039; for #

This doesn&#039;t work either:

class OrderMailer &lt; ActionMailer::Base
 include ApplicationHelper
 layout &#039;emails&#039;
 . . .
end</description>
		<content:encoded><![CDATA[<p>Could you help me please? I cannot use this in email layout, somehow&#8230;</p>
<p>in application_helper.rb I have<br />
 def image_url(source)<br />
   abs_path = image_path(source)<br />
   unless abs_path =~ /^http/<br />
     abs_path = &#8220;#{request.protocol}#{request.host_with_port}#{abs_path}&#8221;<br />
   end<br />
   abs_path<br />
 end<br />
and in my email model (order_mailer.rb) I have<br />
class OrderMailer &lt; ActionMailer::Base<br />
 layout &#039;emails&#039;<br />
 . . .<br />
end</p>
<p>but when I use  I get<br />
undefined method `image_url&#8217; for #</p>
<p>This doesn&#8217;t work either:</p>
<p>class OrderMailer &lt; ActionMailer::Base<br />
 include ApplicationHelper<br />
 layout &#039;emails&#039;<br />
 . . .<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavol Rusnak</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/comment-page-1/#comment-10307</link>
		<dc:creator>Pavol Rusnak</dc:creator>
		<pubDate>Tue, 29 Dec 2009 21:50:59 +0000</pubDate>
		<guid isPermaLink="false">http://stick.gk2.sk/?p=997#comment-10307</guid>
		<description>&lt;a href=&quot;#comment-10306&quot; rel=&quot;nofollow&quot;&gt;@joserwan &lt;/a&gt; 
I know about image_path. It is even used in the code! The problem is that image_path does not always create a full URL.</description>
		<content:encoded><![CDATA[<p><a href="#comment-10306" rel="nofollow">@joserwan </a><br />
I know about image_path. It is even used in the code! The problem is that image_path does not always create a full URL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joserwan</title>
		<link>http://stick.gk2.sk/blog/2009/12/image_url-function-in-ruby-on-rails/comment-page-1/#comment-10306</link>
		<dc:creator>joserwan</dc:creator>
		<pubDate>Tue, 29 Dec 2009 19:38:23 +0000</pubDate>
		<guid isPermaLink="false">http://stick.gk2.sk/?p=997#comment-10306</guid>
		<description>See image_path(source) : http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#M001720</description>
		<content:encoded><![CDATA[<p>See image_path(source) : <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#M001720" rel="nofollow">http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#M001720</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

