Ruby on Rails - Problems Solution
Solved
Problem:
/home/oligny/private/gem/gems/actionmailer-2.3.12/lib/action_mailer/base.rb:433:in `method_missing': undefined method `default' for Mailer:Class (NoMethodError)
from /home/oligny/www/cbuy/app/models/mailer.rb:3
Solution:
You are using a too old version of actionmailer
Problem:
/home/oligny/www/premailer/premailer/lib/premailer/adapter.rb:41:in `default': No suitable adapter for Premailer was found, please install hpricot or nokogiri (RuntimeError)
from /home/oligny/www/premailer/premailer/lib/premailer/adapter.rb:21:in `use'
from /home/oligny/www/premailer/premailer/lib/premailer/premailer.rb:129:in `initialize'
from premailer/bin/premailer:87:in `new'
from premailer/bin/premailer:87
Solution:
Problem:
undefined local variable or method `logger' for FileColumn::ImgProcessorExtension:Module
Solution:
logger.info("text here") => Rails.logger.info("text here")
Problem:
Gem::LoadError in ProductsController#index
RubyGem version error: rmagick(2.7.1 not >= 0)
gem list shows that I have installed rmagick (2.7.1 mswin32)
Solution:
I had the very same problem in Ruby 1.8.7 as you with 1.9.1. This is a way I've resolved it:
Uninstall the rmagick gem if you have it (gem uninstall rmagick)
Download http://rubyforge.org/frs/download.php/64917/RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip
Unpack the zip to separate folder (e.g. C:\temp\rmagick)
Install the ImageMagick-6.5.6-8-Q8-windows-dll.exe
Unpack the rmagick-2.12.0-x86-mswin32.gem to separate folder (e.g. C:\temp\rmagick\gem)
Extract the data.tar.gz to separate folder (e.g. C:\temp\rmagick\gem\data)
Open rmagick.gemspec and remove the line with s.platform = "mswin32"
Use "gem build rgmagick.gemspec" to build the gem again (a "rmagick-2.12.0.gem" will be generated)
Use "gem install rmagick --local" to install it.
Credits to Martin Cohen
Problem:
NameError in ProductsController#index
uninitialized constant FileColumn::ClassMethods::Inflector
RAILS_ROOT: D:/Webpages.SVN/community-buy.com
Solution: Add ActiveSupport:: in front of Inflector.underscore(self.name).to_s, in file file_column.rb:
my_options = FileColumn::init_options(options,
ActiveSupport::Inflector.underscore(self.name).to_s,
attr.to_s)
Problem:
NoMethodError in ProductsController#index
undefined method `file_column' for #
RAILS_ROOT: D:/Webpages.SVN/community-buy.com
Application Trace | Framework Trace | Full Trace
D:/Webpages.SVN/community-buy.com/vendor/rails/activerecord/lib/active_record/base.rb:1964:in `method_missing'
Solution: You need to install file_column as a plugin, not only as a gem
Problem:
gem install rmagick
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
C:/Ruby187/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
Invalid drive specification.
Unable to get ImageMagick version
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby187/bin/ruby
Gem files will remain installed in C:/Ruby187/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to C:/Ruby187/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Solution: On windows, dont install gem rmagick, but install gem rmagick-win32
Problem: The DevKit does not install correctly. I follow exactly the instructions but aftewards all gem install requiring DevKit fails with :
gem install rdiscount --platform=ruby
ERROR: Error installing rdiscount:
The 'rdiscount' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Solution: erase these files:
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/defaults/operating_system.rb
C:/Ruby187/lib/ruby/site_ruby/devkit.rb
Then re-run the DevKit install:
C:\Ruby187\devkit>ruby dk.rb install
[INFO] Installing C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/defaults/operating_system.rb
[INFO] Installing C:/Ruby187/lib/ruby/site_ruby/devkit.rb
C:\Ruby187\devkit>gem install rdiscount --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed rdiscount-1.6.8
1 gem installed
Installing ri documentation for rdiscount-1.6.8...
Installing RDoc documentation for rdiscount-1.6.8...
Yeah!!
Problem:
How to install RMagick on Linux for a Ruby 1.8.7 installation, in a custom install dir.
Solution:
Download rmagick-2.13.1.gem
gem install rmagick --install-dir /home/oligny/private/gem
Problem:
NameError (uninitialized constant UsersController::Mailer):
app/controllers/users_controller.rb:14:in `create'
dispatch.cgi:23
Solution:
Problem:
$ rake generate_session_store
(in /home/oligny/www/tracker)
Missing the i18n 0.4.2 gem. Please `gem install -v=0.4.2 i18n`
Solution:
Upload your .gem to a specific folder (/home/oligny/private/gem), then use the --install-dir option
$ gem install -v=0.4.2 i18n --install-dir /home/oligny/private/gem
Then $ rake generate_session_store passes
ALSO!!
export GEM_PATH=$HOME/.gem:/home/oligny/private/gem
export PATH=/home/oligny/private/ruby/bin/:$PATH
export GEM_HOME=/home/oligny/private/gem/
- download and extract ruby gem,
ruby setup.rb --prefix=/home/oligny/private/gem
Problem:
oligny@s483:/home/oligny/www/tracker/public$ ruby ./dispatch.cgi
/home/oligny/www/tracker/vendor/rails/activesupport/lib/active_support/whiny_nil.rb:52:in `method_missing': undefined method `env_table' for nil:NilClass (NoMethodError)
from /home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `__send__'
from /home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
from /home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
from /home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:27:in `dispatch'
from ./dispatch.cgi:10
Solution:?
gem install passenger-2.2.0.gem --install-dir /home/oligny/private/gem
gem uninstall passenger-2.2.0 --install-dir /home/oligny/private/gem
other solution
<< I tracked the problem to a point where it seems that cgi object that needs to be passed to rails/actionpack/lib/action_controller/cgi_process.rb:22 just isn't created somehow. Creating it manually in dispatch.cgi and passing it on, like this:
require 'cgi' Dispatcher.dispatch(CGI.new).
Also this patch to cgi_process.rb (in redmine)
--- ../src/redmine-1.2.0/./vendor/rails/actionpack/lib/action_controller/cgi_process.rb 2011-05-31 02:53:34.000000000 +1000
+++ ./vendor/rails/actionpack/lib/action_controller/cgi_process.rb 2011-06-12 16:09:27.000000000 +1000
@@ -19,7 +19,7 @@
end
def self.dispatch_cgi(app, cgi, out = $stdout)
- env = cgi.__send__(:env_table)
+ env = cgi.__send__(:env_table).to_hash
env.delete "HTTP_CONTENT_LENGTH"
cgi.stdinput.extend ProperStream
@@ -48,7 +48,7 @@
headers['Status'] = status.to_s
- if headers.include?('Set-Cookie')
+ if headers.include?('Set-Cookie') and headers['Set-Cookie'] != nil
headers['cookie'] = headers.delete('Set-Cookie').split("\n")
end
and the following patch to ruby:
--- ../src/ruby-1.8.7-p334/lib/cgi.rb 2009-12-14 13:40:07.000000000 +1100
+++ ../lib/ruby/1.8/cgi.rb 2011-06-12 19:23:41.000000000 +1000
@@ -551,7 +551,7 @@
options["type"] = "text/html"
end
- if options.has_key?("charset")
+ if options.has_key?("charset") and options["charset"] != nil
options["type"] += "; charset=" + options.delete("charset")
end
@@ -588,13 +588,19 @@
buf += "Connection: " + options.delete("connection") + EOL
end
- buf += "Content-Type: " + options.delete("type") + EOL
+ if options.has_key?("type") and options["type"] != nil
+ buf += "Content-Type: " + options.delete("type") + EOL
+ elsif options.has_key?("Content-Type") and options["Content-Type"] != nil
+ buf += "Content-Type: " + options.delete("Content-Type") + EOL
+ else
+ buf += "Content-Type: " + "text/plain" + EOL
+ end
if options.has_key?("length")
buf += "Content-Length: " + options.delete("length").to_s + EOL
end
- if options.has_key?("language")
+ if options.has_key?("language") and options["language"] != nil
buf += "Content-Language: " + options.delete("language") + EOL
end
>> -- http://www.redmine.org/issues/4610
Problem: Rails 2.3.11 is required and my host only has Rails 2.2.3
Solution:
gem install -v=2.3.11 rails --install-dir /home/oligny/private/gem
update:
gem install -v=2.3.12 rails --install-dir /home/oligny/private/gem
Problem:
C:/Ruby192/lib/ruby/1.9.1/net/http.rb:678:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
Solution:
Problem:
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `require': no such file to load -- initializer (LoadError)
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `require'
Solution: No idea
Problem:
Status: 500 Internal Server Error
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/request.rb:337:in `query_string'
Solution:
export REQUEST_URI=http://tracker.oligny.com/?hello=world
Problem: Ruby needs to be patched but I am on a hosted server and does not control the ruby installation.
Solution: Install ruby in your home folder by compiling it from sources, full instructions:
(package ruby-1.8.7-p352.zip)
./configure --prefix=/home/oligny/private/ruby
make
make install
(package rubygems-1.6.2.zip)
Install rubygem: (!! also the one to use in ssh, this is the one to use in linux !!)
export GEM_PATH=/home/oligny/private/ruby/lib/ruby/gems/1.8:/home/oligny/private/gem
export PATH=/home/oligny/private/ruby/bin/:/home/oligny/private/ruby/gem/bin:$PATH
export GEM_HOME=/home/oligny/private/ruby/gems/
export RUBYLIB=/home/oligny/private/ruby/lib/ruby:/home/oligny/private/ruby/lib:/home/oligny/private/ruby/lib/ruby/site_ruby/1.8
- download and extract ruby gem,
# dont do that, dont use prefix here!!! :ruby setup.rb --prefix=/home/oligny/private/ruby, just do:
ruby setup.rb
(package mysql, no pre-download: live-download: mysql-2.8.1.gem)
gem install mysql --install-dir /home/oligny/private/gem
Problem: (with Rack 1.1.2)
Status: 500 Internal Server Error
Illegal seek
/home/oligny/private/gem/gems/rack-1.1.2/lib/rack/request.rb:155:in `rewind'
/home/oligny/private/gem/gems/rack-1.1.2/lib/rack/request.rb:155:in `POST'
/home/oligny/private/gem/gems/rack-1.1.2/lib/rack/methodoverride.rb:15:in `call'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:99:in `call'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
/home/oligny/private/gem/gems/rack-1.1.2/lib/rack/lock.rb:11:in `call'
/home/oligny/private/gem/gems/rack-1.1.2/lib/rack/lock.rb:11:in `synchronize'
/home/oligny/private/gem/gems/rack-1.1.2/lib/rack/lock.rb:11:in `call'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in `call'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in `run'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in `call'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:44:in `dispatch_cgi'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
/home/oligny/www/tracker/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:27:in `dispatch'
dispatch.cgi:42
Solution:
Patch on request.rb
line 155
- @env["rack.input"].rewind
+ @env["rack.input"].rewind if @env["rack.input"].is_a? StringIO || !@env["rack.input"].stat.chardev?
Patch on utils.rb
line 451
- input.rewind
+ input.rewind if input.rewind.is_a? StringIO || !input.rewind.stat.chardev?
Problem:
Redmine on Apache with dispatch.cgi is VERY SLOW !!! Like 10 seconds par page
Top 1 solution :)
ruby script/server webrick -e production -p 2525
then redirect .htaccess to this port
Solution not working:
Install fastcgi
gem install -v=2.4.0 fcgi --install-dir /home/oligny/private/gem
./configure --prefix=/home/oligny/private/ruby/fcgi --exec-prefix=/home/oligny/private/ruby/fcgi
make
make install
if you get the following error, add #include to start of fcgio.cpp.
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../include -g -O2 -c fcgio.cpp -MT fcgio.lo -MD -MP -MF .deps/fcgio.TPlo -fPIC -DPIC -o .libs/fcgio.lo
fcgio.cpp: In destructor 'virtual fcgi_streambuf::~fcgi_streambuf()':
fcgio.cpp:50: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::overflow(int)':
fcgio.cpp:70: error: 'EOF' was not declared in this scope
fcgio.cpp:75: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::sync()':
fcgio.cpp:86: error: 'EOF' was not declared in this scope
fcgio.cpp:87: error: 'EOF' was not declared in this scope
fcgio.cpp: In member function 'virtual int fcgi_streambuf::underflow()':
fcgio.cpp:107: error: 'EOF' was not declared in this scope
make[2]: *** [fcgio.lo] Error 1
make[2]: Leaving directory `/home/oligny/private/fcgi-2.4.0/libfcgi'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/oligny/private/fcgi-2.4.0'
make: *** [all] Error 2
Then:
#gem install fcgi --install-dir /home/oligny/private/gem --with-fcgi-include /home/oligny/private/ruby/fcgi/include
gem install fcgi --install-dir /home/oligny/private/gem -r -- --with-fcgi-lib=/home/oligny/private/ruby/fcgi/lib --with-fcgi-include=/home/oligny/private/ruby/fcgi/include
Install gem login
gem install --install-dir /home/oligny/private/gem -v=2.1.6 authlogic
https://github.com/binarylogic/authlogic.git
Problem: On rails 2.3.X
oligny@s483:/home/oligny/www/cbuy$ script/generate session user_session
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:99:in `requirement': undefined local variable or method `version_requirements' for # (NameError)
from /home/oligny/private/ruby/lib/rubygems/source_index.rb:269:in `search'
from ./script/../config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:119:in `search'
from /home/oligny/private/ruby/lib/rubygems.rb:247:in `activate'
from /home/oligny/private/ruby/lib/rubygems.rb:1276:in `gem'
from ./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:57:in `add_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:299:in `add_gem_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:299:in `each'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:299:in `add_gem_load_paths'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:132:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /home/oligny/www/cbuy/config/environment.rb:13
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `gem_original_require'
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `require'
from /home/oligny/www/cbuy/vendor/rails/railties/lib/commands/generate.rb:1
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `gem_original_require'
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `require'
Solution:
in environment.rb
if Gem::VERSION >= "1.3.6"
module Rails
class GemDependency
def requirement
r = super
(r == Gem::Requirement.default) ? nil : r
end
end
end
end
Problem: on Rails 2.3.X
oligny@s483:/home/oligny/www/cbuy$ script/generate session user_session
/home/oligny/www/cbuy/vendor/rails/activesupport/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `gem_original_require'
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `require'
from /home/oligny/www/cbuy/vendor/rails/activesupport/lib/active_support.rb:56
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `gem_original_require'
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `require'
from /home/oligny/www/cbuy/vendor/rails/activerecord/lib/active_record.rb:25
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `gem_original_require'
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `require'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:266:in `require_frameworks'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:266:in `each'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:266:in `require_frameworks'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:134:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from /home/oligny/www/cbuy/config/environment.rb:24
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `gem_original_require'
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `require'
from /home/oligny/www/cbuy/vendor/rails/railties/lib/commands/generate.rb:1
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `gem_original_require'
from /home/oligny/private/ruby/lib/rubygems/custom_require.rb:36:in `require'
from script/generate:3
Solution:
Add require thread before require boot:
require 'thread'
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Problem: "authlogic" is already installed but script/generate keeps complaining.
oligny@s483:/home/oligny/www/cbuy$ script/generate session user_session
Missing these required gems:
authlogic
You're running:
ruby 1.8.7.352 at /home/oligny/private/ruby/bin/ruby
rubygems 1.6.2 at /home/oligny/private/ruby/lib/ruby/gems/1.8, /home/oligny/private/gem, /home/oligny/private/ruby/lib/rubygems, /home/oligny/private/ruby/gems/
Run `rake gems:install` to install the missing gems.
Solution: in environment.rb
gem 'authlogic', '=2.1.6'
config.gem "authlogic"
Problem:
oligny@s483:/home/oligny/www/cbuy/public$ ./dispatch.cgi
./../config/environment.rb:19: uninitialized constant Gem (NameError)
from ./dispatch.cgi:3:in `require'
from ./dispatch.cgi:3
Solution:
Remove the Gem:: stuff in your environment.rb (partial solution because it breaks the scripts/generate)
Problem:
/home/oligny/private/gem/gems/actionpack-2.3.12/lib/action_controller/cgi_process.rb:22:in `__send__': undefined method `env_table' for nil:NilClass (NoMethodError)
from /home/oligny/private/gem/gems/actionpack-2.3.12/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
from /home/oligny/private/gem/gems/actionpack-2.3.12/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
from /home/oligny/private/gem/gems/actionpack-2.3.12/lib/action_controller/dispatcher.rb:27:in `dispatch'
from ./dispatch.cgi:17
Solution: Do the patch as above to cgi_process.rb
Problem:
Status: 500 Internal Server Error
private method `split' called for nil:NilClass
/home/oligny/private/gem/gems/actionpack-2.3.12/lib/action_controller/request.rb:337:in `query_string'
/home/oligny/private/gem/gems/rack-1.1.2/lib/rack/request.rb:127:in `GET'
Solution:
Problem:
oligny@s483:/home/oligny/www/cbuy/script$ /home/oligny/private/gem/gems/rake-0.9.2/bin/rake db:migrate RAILS_ENV=production
(in /home/oligny/www/cbuy)
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
uninitialized constant RDoc
Solution:
gem install --install-dir /home/oligny/private/gem rdoc
gem install --install-dir /home/oligny/private/gem rdoc-data
Then edit Rakefile: replace require 'rake/rdoctask' with require 'rdoc/task'
Problem:
On windows, Ruby 1.8.7 from (rubyinstaller-1.8.7-p352.exe)
With rails 3.1.0
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in `gem_original_require': no such file to load -- initializer (LoadError)
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:53:in
`require'
from ./../config/boot.rb:55:in `load_initializer'
from ./../config/boot.rb:38:in `run'
from ./../config/boot.rb:11:in `boot!'
from ./../config/boot.rb:110
from server:2:in `require'
from server:2
Solution: Put in vendor railties
Problem:
D:/Webpages.SVN/community-buy.com/vendor/rails/activesupport/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from D:/Webpages.SVN/community-buy.com/vendor/rails/activesupport/lib/active_support.rb:56
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from D:/Webpages.SVN/community-buy.com/vendor/rails/railties/lib/commands/server.rb:1
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from server:3
Solution:
Add require 'thread' a little bit above the require that crashes, in my case in script/server, before require boot
Problem:
./../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:99:in `requirement': undefined local variable or method `version_requirements' for # (NameError)
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:281:in `search'
from ./../config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:119:in `search'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:243:in `activate_dep'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:236:in `activate'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:1307:in `gem'
from ./../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:57:in `add_load_paths'
from ./../config/../vendor/rails/railties/lib/initializer.rb:299:in `add_gem_load_paths'
from ./../config/../vendor/rails/railties/lib/initializer.rb:299:in `each'
from ./../config/../vendor/rails/railties/lib/initializer.rb:299:in `add_gem_load_paths'
from ./../config/../vendor/rails/railties/lib/initializer.rb:132:in `process'
from ./../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
from ./../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
from D:/Webpages.SVN/community-buy.com/config/environment.rb:35
Solution: Put this in the top part of environment.rb, unfortunately that breaks some other environment where Gem:: is not resolved
if Gem::VERSION >= "1.3.6"
module Rails
class GemDependency
def requirement
r = super
(r == Gem::Requirement.default) ? nil : r
end
end
end
end
Howto install html5 boilerplate with compass and cie
gem install --install-dir /home/oligny/private/gem compass
gem install --install-dir /home/oligny/private/gem haml
gem install --install-dir /home/oligny/private/gem html5-boilerplate
Problem:
ActionView::TemplateError (undefined method `html_safe' for #) on line #3 of app/views/layouts/application.html.haml:
1: !!! 5
2: -# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
3: -ie_html :class => 'no-js', :lang => 'en' do
4: %head
5: -# To render a different stylesheet partial inside the head (i.e. for admin layout)
6: -# just copy _stylesheets.html.haml, and point to that partial instead.
C:/Ruby187/lib/ruby/gems/1.8/gems/html5-boilerplate-1.0.0/lib/app/helpers/html5_boilerplate_helper.rb:6:in `ie_tag'
C:/Ruby187/lib/ruby/gems/1.8/gems/html5-boilerplate-1.0.0/lib/app/helpers/html5_boilerplate_helper.rb:17:in `ie_html'
Solution:
You require this file activesupport/lib/active_support/core_ext/string/output_safety.rb
Which you can obtain by doing:
Install activesupport gem -v=2.3.12, and the copy/paste it put it in app_root/vendors/rails/activesupport
Problem:
ActionView::TemplateError (undefined local variable or method `csrf_meta_tag' for #) on line #26 of app/views/layouts/_head.html.haml:
23: -# Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
24: = javascript_include_tag 'modernizr.min', 'respond.min'
25:
26: = csrf_meta_tag
app/views/layouts/_head.html.haml:26:in `_run_haml_app47views47layouts47_head46html46haml_locals_head_object_stylesheet_partial'
Solution:
If you are using Rails 2.3.X, remove csrf_meta_tag in your view/layout. I haven't find the correct fix yet, please let me know.
Problem:
In rails 2.3.X, haml files are not compiled nor used.
Solution: Create a config/application.rb, and add it in:
config.generators do |g|
g.template_engine :haml
# you can also specify a different test framework or ORM here
# g.test_framework :rspec
# g.orm :mongoid
end
Problem: on Apache
Status: 500 Internal Server Error
File to import not found or unreadable: html5-boilerplate.
Load path: /home/oligny/www/cbuy/public/stylesheets/sass
/home/oligny/www/cbuy/public/stylesheets/sass/style.scss:5
/home/oligny/private/gem/gems/sass-3.1.10/rails/../lib/sass/../sass/tree/import_node.rb:64:in `import'
Problem: I want to read the documentation for rails 2.3.X version, but all I find is about 3.X
Solution: http://guides.rubyonrails.org/v2.3.11/
September 2011, Montreal