Rails application not starting - ruby-on-rails

I have a new application that is giving me errors when I do
rails server
Here is the error:
/home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /home/agenadinik in PATH, mode 040777
/home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /home/agenadinik in PATH, mode 040777
=> Booting WEBrick
=> Rails 3.0.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/builder.rb:35:in `eval': /home/agenadinik/workspace/udfr/config.ru:6: syntax error, unexpected keyword_end, expecting ')' (SyntaxError)
from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/builder.rb:35:in `parse_file'
from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:162:in `app'
from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:248:in `wrapped_app'
from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:213:in `start'
from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/server.rb:65:in `start'
from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
It seems to be complaining about my config.ru file. Here it is:
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Udfr::Application
Here is my environment.rb file:
# Load the rails application
require File.join(File.dirname(__FILE__), 'boot')
require File.expand_path('../application', __FILE__)
if RUBY_PLATFORM =~ /java/
require 'rubygems'
RAILS_CONNECTION_ADAPTERS = %w(jdbc)
end
# Initialize the rails application
Rails::Initializer.run do |config|
Udfr::Application.initialize!
I changed that file according to these instructions:
http://www.digitalsanctum.com/2007/07/24/jruby-deploying-a-rails-application-on-tomcat/
Any idea what the problem is?

The instructions you followed are for Rails 2 and will not work with your Rails 3 app.
The updated instructions for getting Ruby on Rails to work on jruby are to edit your gemfile and place your gem requirements there.
In Gemfile:
if defined?(JRUBY_VERSION)
gem 'activerecord-jdbc-adapter'
end
Then run bundle.

Related

"rails activestorage:update" errors out while upgrading to rails 6

I am performing an upgrade in rails version from 5.2.3 to 6.0.0 in our application and ended up with the following error when I run rails app:update and accept default changes.
Overwrite /Users/pk064816/solemnity/bin/setup? (enter "h" for help) [Ynaqdhm] y
force bin/setup
identical bin/yarn
rails active_storage:update
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/rule_monger-0.3.0/lib/rule_monger.rb:17: warning: already initialized constant HOST_PORT
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/netapp_oncommand_rest-0.2.1/lib/netapp_oncommand_rest.rb:21: warning: previous definition of HOST_PORT was here
rails aborted!
NameError: wrong constant name [[:error, ["detected unsupported rails version 6.0.0"], nil]]
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/new_relic/control/class_methods.rb:52:in `const_get'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/new_relic/control/class_methods.rb:52:in `load_framework_class'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/new_relic/control/class_methods.rb:32:in `new_instance'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/new_relic/control/class_methods.rb:13:in `instance'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/newrelic_rpm-5.7.0.350/lib/newrelic_rpm.rb:41:in `block in <class:Railtie>'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
/Users/pk064816/ClosedStack/config/environment.rb:5:in `<main>'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/application.rb:339:in `require_environment!'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/application.rb:515:in `block in run_tasks_blocks'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/command.rb:48:in `invoke'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/pk064816/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
bin/rails:8:in `<main>'
Tasks: TOP => active_storage:update => environment
(See full trace by running task with --trace)
After this, check Rails upgrade guide at https://guides.rubyonrails.org/upgrading_ruby_on_rails.html for more details about upgrading your app.
I do not really make use of activestorage inside the application and any configs specific to activestorage are only the defaults obtained from rails 5.2.3.
Here's what I have in my bin/rails:
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
and in bin/setup:
#!/usr/bin/env ruby
require 'fileutils'
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# Install JavaScript dependencies
# system('bin/yarn')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:prepare'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
and config/application.rb
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Solemnity
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Use Resque for our Active::Jobs
config.active_job.queue_adapter = :resque
# Add lib to autoload path
config.eager_load_paths << "#{Rails.root}/lib"
config.time_zone = 'Central Time (US & Canada)'
config.exceptions_app = self.routes
end
end
I tried to disable the use of activestorage, but that didn't really work! I am not entirely sure what's causing an error here and would really appreciate any help in working around this problem!

How to add iframe to sanitized tags in ruby on rails 4.2.6?

I am trying to add iframe to santized tags by using
config.action_view.sanitized_allowed_tags
I tried to find what tags are already allowed by using the console.
uraai#raiuorial:~/workspace/corse (master) $ heroku run rails c
Running rails c on ⬢ fa4... up, run.9396
Loading production environment (Rails 4.2.6)
irb(main):001:0> puts helper.sanitized_allowed_tags.to_a
NoMethodError: undefined method `sanitized_allowed_tags' for #<ActionView::Base:0x007f18ea91ea60>
from /app/vendor/bundle/ruby/2.3.0/gems/metamagic-3.1.7/lib/metamagic/view_helper.rb:30:in `method_missing'
from (irb):1
from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:110:in `start'
from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in `start'
from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:in `console'
from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from /app/bin/rails:8:in `require'
from /app/bin/rails:8:in `<main>'
irb(main):002:0>
Any idea how to add it without ignoring the other tags? Thanks
Please have a look on the next example:
module Tapp
class Application < Rails::Application
# In config/application.rb
config.action_view.sanitized_allowed_tags = ['strong', 'em', 'a', 'br', 'iframe']
# ...
end
My app called Tapp, I'm pretty sure you will have another name here ;)
Then in the console:
[retgoat#iMac-Roman ~/workspace/tapp]$ rc
Loading development environment (Rails 4.2.6)
[1] pry(main)> Tapp::Application.config.action_view[:sanitized_allowed_tags]
=> ["strong", "em", "a", "br", "iframe"]

Access my model from foreverb daemon

I have the following code on a foreverb daemon to access my Availability model. but I always get the following error:
uninitialized constant Availability
Here is my daemon:
#!/usr/bin/ruby
require 'rubygems' unless defined?(Gem)
require 'forever'
require 'mongoid'
Forever.run do
every 10.seconds do
#classes = Availability.where(:availability_date.gt => Time.now.utc + 1.hours).to_a
puts #classes.count
end
end
Thanks for your help.
Note: I'm using rails3 and mongoid.
UPDATED CODE
#!/usr/bin/env ruby
require 'rubygems' unless defined?(Gem)
require 'forever'
require 'mongoid'
require File.expand_path('../config/environment', __FILE__)
Forever.run do
every 10.seconds do
#classes = Availability.where(:availability_date.gt => Time.now.utc + 1.hours).to_a
puts #classes.count
end
end
Now I'm getting the following error:
user/classes_notification.rb; tail -f -n 150 user/sample.log;
/Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require': cannot load such file -- /Users/jeanosorio/repos/blabloo/script/user/config/environment (LoadError)
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from user/classes_notification.rb:6:in `<main>'
UPDATE
UPDATE PATH
#!/usr/bin/env ruby
require 'rubygems' unless defined?(Gem)
require 'forever'
require 'mongoid'
# Load Rails
#ENV['RAILS_ENV'] = ARGV[0] || 'development'
require File.expand_path('../../../config/environment', __FILE__)
Forever.run do
every 10.seconds do
#classes = Availability.where(:availability_date.gt => Time.now.utc + 1.hours).to_a
puts #classes.count
end
end
Now I'm getting this eror:
script/user/classes_notification.rb; tail -f -n 150 script/user/sample.log;
WARN: Unresolved specs during Gem::Specification.reset:
thor (>= 0.15.0)
tzinfo (~> 0.3.22)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/jeanosorio/.rvm/gems/ruby-1.9.3-p484#global/gems/bundler-1.5.2/lib/bundler/runtime.rb:34:in `block in setup': You have already activated multi_json 1.10.1, but your Gemfile requires multi_json 1.8.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p484#global/gems/bundler-1.5.2/lib/bundler/runtime.rb:19:in `setup'
from /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p484#global/gems/bundler-1.5.2/lib/bundler.rb:119:in `setup'
from /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p484#global/gems/bundler-1.5.2/lib/bundler/setup.rb:7:in `<top (required)>'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
from /Users/jeanosorio/repos/blabloo/config/boot.rb:6:in `<top (required)>'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from /Users/jeanosorio/repos/blabloo/config/application.rb:1:in `<top (required)>'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from /Users/jeanosorio/repos/blabloo/config/environment.rb:2:in `<top (required)>'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from /Users/jeanosorio/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
from script/user/classes_notification.rb:9:in `<main>'
This is very easy load Rails env just add to top of your script:
#!/usr/bin/env ruby
require File.expand_path('../config/environment', __FILE__)
Worked this simple 3 lines script in Rails.root dir.
Another examples

How to install a plugin in rails 3, getting a Commands is not a module (TypeError)

I'm trying to install this as a plugin:
https://github.com/phatworx/rack_ip_restrictor
So I run:
$ rails plugin install git://github.com/phatworx/rack_ip_restrictor.git
This errors with:
/Users/userme/.rvm/gems/ruby-1.9.2-p180#andyw/gems/railties-3.0.5/lib/rails/commands/plugin.rb:277:in `<top (required)>': Commands is not a module (TypeError)
from /Users/userme/.rvm/gems/ruby-1.9.2-p180#andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180#andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `block in require'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180#andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180#andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180#andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180#andyw/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
from /Users/userme/.rvm/gems/ruby-1.9.2-p180#andyw/gems/railties-3.0.5/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Suggestions, ideas? Thanks
There's a solution out on GitHub - check the comments.
#acconrad is correct. the concrete solution is ( If you use rails 3.0.9- with rake 0.9.2, you should add include Rake::DSL to Rakefile just after require 'rake'.
Then add module Commands; end to script/rails just before require 'rails/commands', you will not get 'Commands is not a module (TypeError)' error message any more.) :
1.in Rakefile,
require File.expand_path('../config/application', __FILE__)
require 'rake'
# add this line of code
include Rake::DSL
2.in script/rails:
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
# add this line of code
module Commands; end
require 'rails/commands'
3.then run this command:
$ bundle exec rails plugin install git://github.com/sbecker/asset_packager.git
the plugin will be installed.
Have you tried with rails 3.0.10. It should work with 3.0.10 actually!

Haml installation in Rails app failing

I have a small rails app I got all gung-ho on tonight wanting to convert all the erb to haml templates. The Haml docs suggest running haml --rails /path/to/app to install it as a plugin (using the gem already installed on the system).
Unfortunately, when I attempt to start the webserver for rails, I receive the following error:
/code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant Haml (NameError)
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
from /code/src/myapp/config/environment.rb:15
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:111:in `run'
from /code/src/myapp/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 /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /code/src/myapp/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require'
from /code/src/myapp/vendor/rails/railties/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 ./script/server:3
It's barfing on a line in my environment file:
# Be sure to restart your server when you modify this file
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
# Add additional load paths for your own custom dirs
config.load_paths += %W(
#{RAILS_ROOT}/lib/
)
# Specify gems that this application depends on and have them installed with rake gems:install
config.gem 'twitter'
config.gem 'newrelic_rpm'
Haml::Template.options[:format] = :html5
Haml::Template.options[:attr_wrapper] = '"'
config.plugins = [ :all ]
config.active_record.observers = :user_observer
config.time_zone = 'UTC' # "rake -D time" for all time zone names.
end
ConsumerConfig = YAML.load(File.read(Rails.root + 'config' + 'twitter-auth.yml'))
The error is on the line attempting to set some Haml options (Haml::Template.options[:format] = :html5). Installing the haml plugin with script/plugin install yields the same error, as does require haml at the top of environment.rb. Not sure if it makes a difference, but rails is frozen in vendor/rails.
This is very confusing to me, please assist if you can figure this out.
Does it work if you move the Haml::Template configuration after the Initializer block? It could be that Rails isn't loading the plugin until after the initializer is run.

Resources