# Rails 3.0, setting asset\_host class

**URL:** <https://www.ruby-forum.com/t/rails-3-0-setting-asset-host-class/194311>\
**Category:** Rails\
**Created:** [September 2, 2010, 9:40am UTC](https://www.ruby-forum.com/t/rails-3-0-setting-asset-host-class/194311 "2010-09-02T09:40:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/848f3c/32.png) [@kyle](https://www.ruby-forum.com/u/kyle)\
**Post date:** [September 2, 2010, 9:40am UTC](https://www.ruby-forum.com/t/rails-3-0-setting-asset-host-class/194311/1 "2010-09-02T09:40:26Z")

</div>

I am upgrading to Rails 3.0, but am having a difficult time getting it  
to boot. I have a custom asset host class that passes the name of the  
asset host into its constructor. I set this class in each of the  
environment configuration file. For instance, in development.rb, I  
have:

ActionController::Base.asset\_host = AssetHostingWithSsl.new(“http://  
asset%d.awesomeapp.local”)

However, when trying to get rails to load, I get the following error:

“uninitialized constant AssetHostingWithSsl (NameError)”

I have asset\_hosting\_with\_ssl.rb with the class definition in the lib  
directory, which should be in the load path.

Any ideas?

---

<div class="post-metadata">

**Author:** ![kyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/848f3c/32.png) [@kyle](https://www.ruby-forum.com/u/kyle)\
**Post date:** [September 2, 2010, 10:12am UTC](https://www.ruby-forum.com/t/rails-3-0-setting-asset-host-class/194311/2 "2010-09-02T10:12:38Z")

</div>

On 2 September 2010 02:32, Kyle [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> “uninitialized constant AssetHostingWithSsl (NameError)”
> 
> I have asset\_hosting\_with\_ssl.rb with the class definition in the lib  
> directory, which should be in the load path.
> 
> Any ideas?

As of Rails 3, the lib directory isn’t autoloaded. You can either  
require the file manually where you need it, or tell Rails to autoload  
lib (in environment.rb), or create a new directory for autoloaded  
files tell Rails to autoload that.

Chris

---

<div class="post-metadata">

**Author:** ![kyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/848f3c/32.png) [@kyle](https://www.ruby-forum.com/u/kyle)\
**Post date:** [September 6, 2010, 4:39pm UTC](https://www.ruby-forum.com/t/rails-3-0-setting-asset-host-class/194311/3 "2010-09-06T16:39:46Z")

</div>

Ok, thanks. I think I’ll put it in an initializer, actually, as  
that’s where it seems most of the configuration is headed to.
