Just putting this out there before I make a pull request. Is there any interest in an asset_url method as a view helper? It would work by using the config.action_controller.asset_host if it exists and prepending this to the results of asset_path. I have found this necessary when writing html emails and needing a full url path for assets. Since my CDN in the asset_host mirrors my assets in my app it makes perfect sense. Might not be a common enough use case to put into core though. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/itwdyjwfSJIJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
I think this is how all the assets helpers work by default. https://github.com/rails/rails/blob/e826a5c749f9a4029a3b2a7e3d371498feeb9b10/actionpack/lib/action_view/asset_paths.rb#L108 Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Thu, Oct 18, 2012 at 8:44 PM, Scott Carleton <carleton.scott@gmail.com>wrote:> Just putting this out there before I make a pull request. > > Is there any interest in an asset_url method as a view helper? > > It would work by using the config.action_controller.asset_host if it > exists and prepending this to the results of asset_path. > > I have found this necessary when writing html emails and needing a full > url path for assets. Since my CDN in the asset_host mirrors my assets in > my app it makes perfect sense. Might not be a common enough use case to > put into core though. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-core/-/itwdyjwfSJIJ. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
I haven''t had time to test but you''re saying the asset_path helper will provide the full url by default? In console within production environment it seems to only return the path which isn''t sufficient for html emails. On Friday, October 19, 2012 9:29:57 AM UTC-4, Rafael Mendonça França wrote:> > I think this is how all the assets helpers work by default. > > > https://github.com/rails/rails/blob/e826a5c749f9a4029a3b2a7e3d371498feeb9b10/actionpack/lib/action_view/asset_paths.rb#L108 > > Rafael Mendonça França > http://twitter.com/rafaelfranca > https://github.com/rafaelfranca > > > > On Thu, Oct 18, 2012 at 8:44 PM, Scott Carleton <carleto...@gmail.com<javascript:> > > wrote: > >> Just putting this out there before I make a pull request. >> >> Is there any interest in an asset_url method as a view helper? >> >> It would work by using the config.action_controller.asset_host if it >> exists and prepending this to the results of asset_path. >> >> I have found this necessary when writing html emails and needing a full >> url path for assets. Since my CDN in the asset_host mirrors my assets in >> my app it makes perfect sense. Might not be a common enough use case to >> put into core though. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-core/-/itwdyjwfSJIJ. >> To post to this group, send email to rubyonra...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> rubyonrails-co...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-core?hl=en. >> > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/eXzbI8y1Cg0J. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
If I remember correctly, asset_path will return the full URL if you set config.action_mailer.asset_host = "http://my.assets.com" in your environment file. On Mon, Oct 29, 2012 at 2:24 PM, Scott Carleton <carleton.scott@gmail.com>wrote:> I haven''t had time to test but you''re saying the asset_path helper will > provide the full url by default? > > In console within production environment it seems to only return the path > which isn''t sufficient for html emails. > > > On Friday, October 19, 2012 9:29:57 AM UTC-4, Rafael Mendonça França wrote: > >> I think this is how all the assets helpers work by default. >> >> https://github.com/rails/**rails/blob/**e826a5c749f9a4029a3b2a7e3d3714** >> 98feeb9b10/actionpack/lib/**action_view/asset_paths.rb#**L108<https://github.com/rails/rails/blob/e826a5c749f9a4029a3b2a7e3d371498feeb9b10/actionpack/lib/action_view/asset_paths.rb#L108> >> >> Rafael Mendonça França >> http://twitter.com/**rafaelfranca <http://twitter.com/rafaelfranca> >> https://github.com/**rafaelfranca <https://github.com/rafaelfranca> >> >> >> >> On Thu, Oct 18, 2012 at 8:44 PM, Scott Carleton <carleto...@gmail.com>wrote: >> >>> Just putting this out there before I make a pull request. >>> >>> Is there any interest in an asset_url method as a view helper? >>> >>> It would work by using the config.action_controller.**asset_host if it >>> exists and prepending this to the results of asset_path. >>> >>> I have found this necessary when writing html emails and needing a full >>> url path for assets. Since my CDN in the asset_host mirrors my assets in >>> my app it makes perfect sense. Might not be a common enough use case to >>> put into core though. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ruby on Rails: Core" group. >>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/rubyonrails-core/-/**itwdyjwfSJIJ<https://groups.google.com/d/msg/rubyonrails-core/-/itwdyjwfSJIJ> >>> . >>> To post to this group, send email to rubyonra...@googlegroups.**com. >>> To unsubscribe from this group, send email to rubyonrails-co...@** >>> googlegroups.com. >>> >>> For more options, visit this group at http://groups.google.com/** >>> group/rubyonrails-core?hl=en<http://groups.google.com/group/rubyonrails-core?hl=en> >>> . >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-core/-/eXzbI8y1Cg0J. > > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Seemingly Similar Threads
- Suggestion: `before_save on: :create` should either work or raise an exception
- Suggestion: use `select` values if `pluck` called with no args
- validates :boolean_field, presence: true misconceptions
- Re: Digest for rubyonrails-core@googlegroups.com - 4 Messages in 3 Topics
- attr_accessible on some properties + attr_protected on others makes class 'open-by-default'