John,

Is this a development console or production?  If it's development, do you 
have config.cache_classes = true set?

Here's what http://edgeguides.rubyonrails.org/configuring.html says about 
the /app directory (emphasis added):


   - 
   
   config.eager_load_paths accepts an array of paths from which Rails will 
   eager load on boot *if cache classes is enabled*. Defaults to every 
   folder in the app directory of the application.
   
I don't have cache classes enabled in development.  If I go into the 
console in my app and output the eager_load_paths, I get:

["/Users/chris/rails/my_app/app/assets",

"/Users/chris/rails/my_app/app/controllers",

"/Users/chris/rails/my_app/app/helpers",

"/Users/chris/rails/my_app/app/mailers", 

"/Users/chris/rails/my_app/app/models",

"/Users/chris/rails/my_app/app/controllers/concerns",

"/Users/chris/rails/my_app/app/models/concerns"]
If I turn on cache_classes, the app/uploaders directory appears as well and 
CarrierWave works, but clearly I don't want to do that.  So for now, I've 
added this to my config/environments/development.rb file:

config.autoload_paths += Dir[Rails.root.join('app', 'uploaders').to_s]

Cheers,

Chris

On Monday, September 15, 2014 5:12:58 PM UTC-7, John Lynch wrote:
>
> Chris, 
>
> I have a working CarrierWave app, and in a console, when I say
>
> Rails.configuration.eager_load_paths
>
> I get a list of all my paths, including all folders under /app, i.e. 
>  “/blah/app/uploaders”, etc.   I believe that Rails will load all those on 
> startup, which means you need to restart your server to pick up any 
> changes. The uploaders path is not in my Rails.configuration.autoload_paths
>
> - john
>
>
>
> On Mon, Sep 15, 2014 at 4:43 PM, Chris McCann wrote:
>
>> SD Ruby,
>>
>> I'm trying to use CarrierWave wave 0.10.0 in Rails 4.1.5 with Ruby 2.1.2. 
>>  This is my first time trying it out having been a PaperClip guy for a long 
>> time.
>>
>> I can't seem to figure out what I need to do so my app can load an 
>> uploader out of the app/uploaders directory. 
>>
>> The error I get when I try to create an instance of a model that uses 
>> mount_uploader is:
>>
>> uninitialized constant SourceImage::SourceImageUploader
>>
>> It seems pretty clear to me that the app hasn't loaded and can't find the 
>> stuff in the app/uploaders directory.  I do have a SourceImageUploader in 
>> the app/uploaders directory.
>>
>> As I understand it adding paths to the autload_paths isn't thread-safe 
>> and is something Matz discourages.  There was a change in CarrierWave 0.8.0 
>> that appears to have removed autoloading (if I'm reading the commit 
>> correctly).
>>
>> I've been through the README and the wiki but I'll darned if I can figure 
>> out what I've done wrong or simply not done in setting up CarrierWave in my 
>> app. 
>>
>> Any help would be appreciated!
>>
>> Cheers,
>>
>> Chris
>>
>> -- 
>> -- 
>> SD Ruby mailing list
>> [email protected]
>> http://groups.google.com/group/sdruby
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "SD Ruby" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to