# Compute\_public\_path should be public instead of private

**URL:** <https://www.ruby-forum.com/t/compute-public-path-should-be-public-instead-of-private/175376>\
**Category:** Rails\
**Created:** [September 12, 2009, 2:55am UTC](https://www.ruby-forum.com/t/compute-public-path-should-be-public-instead-of-private/175376 "2009-09-12T02:55:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![liberte](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@liberte](https://www.ruby-forum.com/u/liberte)\
**Post date:** [September 12, 2009, 2:55am UTC](https://www.ruby-forum.com/t/compute-public-path-should-be-public-instead-of-private/175376/1 "2009-09-12T02:55:59Z")

</div>

Hello, I’m in the middle of a situation where the method  
compute\_public\_path must be public instead of private.

Some times we need to add .mov, .flv or even another kind of asset  
like swf and I want use my correct public path because I already setup  
a exclusive host for my static assets (wich is the right behavior).

I know I can use private methods inside my views, but it doesn’t  
sounds strange? Why we have methods like image\_path and  
javascript\_path (and are all public) but don’t have a method for all  
other kind of static assets?

---

<div class="post-metadata">

**Author:** ![liberte](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@liberte](https://www.ruby-forum.com/u/liberte)\
**Post date:** [September 12, 2009, 4:23am UTC](https://www.ruby-forum.com/t/compute-public-path-should-be-public-instead-of-private/175376/2 "2009-09-12T04:23:47Z")

</div>

Is it possible for you to do something like this:

def explicitly\_compute\_public\_path(source, dir, ext = nil,  
include\_host = true)  
send(:compute\_public\_path, source, dir, ext, include\_host)  
end

–or–

module ActionView  
module Helpers  
module AssetTagHelper  
def explicitly\_compute\_public\_path(source, dir, ext = nil,  
include\_host = true)  
compute\_public\_path(source, dir, ext, include\_host)  
end  
end  
end  
end

WDYT?

---

<div class="post-metadata">

**Author:** ![liberte](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@liberte](https://www.ruby-forum.com/u/liberte)\
**Post date:** [September 13, 2009, 4:10am UTC](https://www.ruby-forum.com/t/compute-public-path-should-be-public-instead-of-private/175376/3 "2009-09-13T04:10:39Z")

</div>

On Sep 12, 2009, at 6:00 PM, Daniel L. wrote:

> I know I can open or access private methods in runtime, but you  
> doesn’t think this method is a good thing to be public?

I’ve personally never understood the rationale for making this method  
private. I’ve had to use it for custom asset-managers in the past and  
it being private leads to this kind of code. Maybe someone else  
understands the rationale because the use case for making it public is  
the existence of assets that were not anticipated in the framework.

---

<div class="post-metadata">

**Author:** ![liberte](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@liberte](https://www.ruby-forum.com/u/liberte)\
**Post date:** [September 13, 2009, 3:02am UTC](https://www.ruby-forum.com/t/compute-public-path-should-be-public-instead-of-private/175376/4 "2009-09-13T03:02:12Z")

</div>

I know I can open or access private methods in runtime, but you  
doesn’t think this method is a good thing to be public?
