Ruby on Rails Saturday, May 29, 2010

After long time I found out init.rb was a plugin specific file and
moved it to /config/initializers

I had to remove this part of the code to make it working:

#reload CE in development
config.after_initialize do
if RAILS_ENV == 'development'
ActiveSupport::Dependencies.load_once_paths =
ActiveSupport::Dependencies.load_once_paths.select {|path| (path =~ /
(community_engine)/).nil? }
end
end


That part gave me an error , any idea how i could fix that? Im not
using a vendor plugin community_engine anymore would setting it to /
work?
Any suggestions on that code part?


On May 29, 2:18 pm, rubybox <voorr...@gmail.com> wrote:
> Im working on an app but have been plagued by an unrecoverable error
>
> module ApplicationConfiguration
>   require 'ostruct'
>   require 'yaml'
>
>   if File.exists?( File.join(Rails.root, 'config',
> 'application.yml') )
>     file = File.join(Rails.root, 'config', 'application.yml')
>     users_app_config = YAML.load_file file
>   end
>
>   #default_app_config = YAML.load_file(File.join(RAILS_ROOT, 'vendor',
> 'plugins', 'config', 'application.yml'))
>   default_app_config = YAML.load_file(File.join(Rails.root, 'config',
> 'application.yml'))
>
>   config_hash = (users_app_config||{}).reverse_merge!
> (default_app_config)
>
>   unless defined?(AppConfig)
>     ::AppConfig = OpenStruct.new config_hash
>   else
>     orig_hash   = AppConfig.marshal_dump
>     merged_hash = config_hash.merge(orig_hash)
>
>     AppConfig = OpenStruct.new merged_hash
>   end
> end
>
> Results in
>
>  Booting Mongrel
> => Rails 2.3.5 application starting onhttp://0.0.0.0:3000/Library/Ruby/Gems/1.8/gems/desert-0.5.3/lib/deser...
> dependencies.rb:15:in `load_missing_constant': Constant AppConfig from
> app_config.rb not found (NameError)
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:80:in
> `const_missing_not_from_s3_library'
>   from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/
> extensions.rb:206:in `const_missing'
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:92:in `const_missing'
>   from /Users/me/Desktop/codes/apache2/rubydocs/portal/config/
> initializers/mce_options.rb:1
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:145:in
> `load_without_new_constant_marking'
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:145:in `load_without_desert'
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:521:in `new_constants_in'
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:145:in `load_without_desert'
>   from /Library/Ruby/Gems/1.8/gems/desert-0.5.3/lib/desert/ruby/
> object.rb:18:in `load'
>   from /Library/Ruby/Gems/1.8/gems/desert-0.5.3/lib/desert/ruby/
> object.rb:32:in `__each_matching_file'
>   from /Library/Ruby/Gems/1.8/gems/desert-0.5.3/lib/desert/ruby/
> object.rb:17:in `load'
>   from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 622:in `load_application_initializers'
>   from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 621:in `each'
>   from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 621:in `load_application_initializers'
>   from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 176:in `process'
>   from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 113:in `send'
>   from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
> 113:in `run'
>   from /Users/me/Desktop/codes/apache2/rubydocs/portal/config/
> environment.rb:5
>   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
>   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `require'
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:521:in `new_constants_in'
>   from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/
> active_support/dependencies.rb:156:in `require'
>   from /Library/Ruby/Gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:
> 84
>   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
>   from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
> `require'
>   from /Users/me/Desktop/codes/apache2/rubydocs/portal/script/server:3
>   from -e:1:in `load'
>   from -e:1
>
> Process finished with exit code 1
>
> Anyone any idea how I could fix this or any point in the right
> direction?
> It seems to have something to do with desert plugin, it also seems
> app_config.rb is non existant

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment