Rails 4.0.0 - Got "no implicit conversion of nil into String" - ruby-on-rails

Just installed a brand new Rails 4.0.0 app and I got this error (https://gist.github.com/hartator/6404820) on http://0.0.0.0:3000:
no implicit conversion of nil into String
activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `initialize'
activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `new'
activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `sqlite3_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
/Users/asa/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/Users/asa/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
activerecord (4.0.0) lib/active_record/connection_handling.rb:79:in `retrieve_connection'
activerecord (4.0.0) lib/active_record/connection_handling.rb:53:in `connection'
My database.yml: http://pastebin.com/JM5TNmNU
I haven't done anything yet to the vanilla rails code. Any idea what could be the issue?
Using:
Rails 4.0.0
Ruby 2.0.0p195
Mountain Lion 10.8.2

That sounds like a problem with your sqlite3 gem installation. Try:
gem pristine sqlite3
From the RubyGems documentation:
gem pristine
Restores installed gems to pristine condition from files located in the gem cache
Usage
gem pristine [GEMNAME ...] [options]
http://guides.rubygems.org/command-reference/#gem_pristine

Related

Rails Devise Gem, (undefined method `to_datetime' for nil:NilClass) when i want to recover a password

i'm having troubles with Devise Gem, i'm using the default recoverable methods, the links is being sent. The reset values (reset_password_sent_at) is saved in the database, but when i have to write down the new password and update it, gives this error
NoMethodError (undefined method `to_datetime' for nil:NilClass):
activesupport (4.0.2) lib/active_support/core_ext/date_time/calculations.rb:161:in `<=>'
activesupport (4.0.2) lib/active_support/core_ext/time/calculations.rb:286:in `compare_with_coercion'
activesupport (4.0.2) lib/active_support/time_with_zone.rb:214:in `<=>'
activerecord (4.0.2) lib/active_record/attribute_methods/dirty.rb:97:in `=='
activerecord (4.0.2) lib/active_record/attribute_methods/dirty.rb:97:in `!='
activerecord (4.0.2) lib/active_record/attribute_methods/dirty.rb:97:in `_field_changed?'
activerecord (4.0.2) lib/active_record/attribute_methods/dirty.rb:66:in `write_attribute'
activerecord (4.0.2) lib/active_record/attribute_methods/time_zone_conversion.rb:39:in `reset_password_sent_at='
devise (3.5.6) lib/devise/models/recoverable.rb:94:in `clear_reset_password_token'
devise (3.5.6) lib/devise/models/recoverable.rb:32:in `block (2 levels) in <module:Recoverable>'
activesupport (4.0.2) lib/active_support/callbacks.rb:377:in `_run__1626105923374900797__update__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
activerecord (4.0.2) lib/active_record/callbacks.rb:310:in `update_record'
activerecord (4.0.2) lib/active_record/timestamp.rb:70:in `update_record'
activerecord (4.0.2) lib/active_record/persistence.rb:477:in `create_or_update'
activerecord (4.0.2) lib/active_record/callbacks.rb:302:in `block in create_or_update'
activesupport (4.0.2) lib/active_support/callbacks.rb:393:in `_run__1626105923374900797__save__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
activerecord (4.0.2) lib/active_record/callbacks.rb:302:in `create_or_update'
activerecord (4.0.2) lib/active_record/persistence.rb:106:in `save'
activerecord (4.0.2) lib/active_record/validations.rb:51:in `save'
activerecord (4.0.2) lib/active_record/attribute_methods/dirty.rb:32:in `save'
activerecord (4.0.2) lib/active_record/transactions.rb:270:in `block (2 levels) in save'
activerecord (4.0.2) lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
activerecord (4.0.2) lib/active_record/transactions.rb:209:in `transaction'
activerecord (4.0.2) lib/active_record/transactions.rb:323:in `with_transaction_returning_status'
activerecord (4.0.2) lib/active_record/transactions.rb:270:in `block in save'
activerecord (4.0.2) lib/active_record/transactions.rb:281:in `rollback_active_record_state!'
activerecord (4.0.2) lib/active_record/transactions.rb:269:in `save'
devise (3.5.6) lib/devise/models/recoverable.rb:48:in `reset_password'
devise (3.5.6) lib/devise/models/recoverable.rb:141:in `reset_password_by_token'
devise (3.5.6) app/controllers/devise/passwords_controller.rb:32:in `update'
debugging this its seems to be a problem with the reset_password_sent_at being nil when the password is reset (lib/devise/models/recoverable.rb:94:inclear_reset_password_token)
I've try to change my local time to the UTC stored but the problem isn't that. Any suggestion?
My solution for this was to upgrade my rails from 4.0.2 to 4.2.7. When i run the bundle install and update the gemfile dependencies now is working.
Upgrading devise from (3.5.6) to (4.2.0)

undefined method `ensure_initialized' rails

I have composite_primary_keys gem install and used with Rails 4.2.0.rc2, and I keep getting a
undefined method `ensure_initialized' for #<ActiveRecord::AttributeSet:0x007fcb319ed988>
error from this line:
Array(self.class.primary_key).each {|key| #attributes.ensure_initialized(key)}
Stack:
/Users/mmahalwy/.rvm/gems/ruby-2.1.2/bundler/gems/composite_primary_keys-0a8061943732/lib/composite_primary_keys/core.rb:6:in `block in init_internals'
/Users/mmahalwy/.rvm/gems/ruby-2.1.2/bundler/gems/composite_primary_keys-0a8061943732/lib/composite_primary_keys/core.rb:6:in `each'
/Users/mmahalwy/.rvm/gems/ruby-2.1.2/bundler/gems/composite_primary_keys-0a8061943732/lib/composite_primary_keys/core.rb:6:in `init_internals'
activerecord (4.2.0.rc2) lib/active_record/core.rb:274:in `initialize'
activerecord (4.2.0.rc2) lib/active_record/inheritance.rb:61:in `new'
activerecord (4.2.0.rc2) lib/active_record/inheritance.rb:61:in `new'
delayed_job (4.0.2) lib/delayed/backend/base.rb:29:in `enqueue'
activejob (4.2.0.rc2) lib/active_job/queue_adapters/delayed_job_adapter.rb:18:in `enqueue'
activejob (4.2.0.rc2) lib/active_job/enqueuing.rb:71:in `block in enqueue'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:190:in `block in simple'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:338:in `call'
activesupport (4.2.0.rc2) lib/active_support/callbacks.rb:338:in `block (2 levels) in simple'
activejob (4.2.0.rc2) lib/active_job/logging.rb:14:in `call'
This is caused by a bug in the version you are using for the gem. update the gem:
bundle update composite_primary_keys
and try again.

Rails undefined method for ActionView::Helpers::TagHelper

I am getting an undefined method error when running rails on a preproduction machine. The error message looks like this:
undefined method `content_tag' for module `ActionView::Helpers::TagHelper'
(in /home/user/my-rails-app/app/assets/javascripts/templates/general/test.mustache)
The error appears in the layout file, on the line that includes 'application.js':
<%= javascript_include_tag "application" %>
The stacktrace looks like this:
kernel/delta/module.rb:39:in `alias_method'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:74:in `__script__'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:59:in `__script__'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:38:in `__script__'
haml (4.0.5) lib/haml/helpers/action_view_mods.rb:1:in `__script__'
kernel/common/code_loader.rb:243:in `require'
kernel/common/kernel.rb:705:in `require'
activesupport (4.0.2) lib/active_support/dependencies.rb:229:in `require'
activesupport (4.0.2) lib/active_support/dependencies.rb:214:in `load_dependency'
activesupport (4.0.2) lib/active_support/dependencies.rb:229:in `require'
haml (4.0.5) lib/haml/template.rb:3:in `__script__'
kernel/common/code_loader.rb:243:in `require'
kernel/common/kernel.rb:705:in `require'
activesupport (4.0.2) lib/active_support/dependencies.rb:229:in `require'
activesupport (4.0.2) lib/active_support/dependencies.rb:214:in `load_dependency'
activesupport (4.0.2) lib/active_support/dependencies.rb:229:in `require'
haml (4.0.5) lib/haml/railtie.rb:5:in `__script__'
kernel/common/eval.rb:43:in `instance_eval'
activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:28:in `on_load'
kernel/bootstrap/array.rb:66:in `each'
activesupport (4.0.2) lib/active_support/lazy_load_hooks.rb:27:in `on_load'
haml (4.0.5) lib/haml/railtie.rb:4:in `__script__'
...
I believe this error is due to the fact that the ActionView::Helpers::TagHelper module does not have content_tag defined at the time that Haml is loaded. (The relevant code is here). For some reason, this issue does not appear in other identical environments. Can anyone suggest a fix/workaround for this issue?
[UPDATE]
This only happens in development mode. I am using rbx-2.2.6, actionpack version 4.0.2, and haml 4.0.5
Found a workaround recently. If you ensure that action view is loaded and then manually load haml, it works correctly.
In application.rb, after requiring rails, but before requiring bundled gems:
require 'action_view'
require 'haml'
Thanks to Isaac for inspiration

Rails, Ruby 1.9.3p0, and mysql gem

I'm running CentOS6 and installed Ruby from source, along with Rails and some other staff.
ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
rails -v
Rails 3.1.3
Some gems:
*** LOCAL GEMS ***
actionmailer (3.1.3, 2.3.14)
actionpack (3.1.3, 2.3.14)
activemodel (3.1.3)
activerecord (3.1.3, 2.3.14)
activeresource (3.1.3, 2.3.14)
activesupport (3.1.3, 2.3.14)
archive-tar-minitar (0.5.2)
arel (2.2.1)
bigdecimal (1.1.0)
bouncy-castle-java (1.5.0146.1)
builder (3.0.0)
bundler (1.0.21)
coderay (0.9.7)
columnize (0.3.5)
edavis10-object_daddy (0.4.3)
erubis (2.7.0)
fastercsv (1.5.0)
ffi (1.0.11)
hike (1.2.1)
hoe (2.12.4)
i18n (0.6.0, 0.4.2)
io-console (0.3)
jruby-openssl (0.7.4)
json (1.5.4)
linecache19 (0.5.13)
mail (2.3.0)
metaclass (0.0.1)
mime-types (1.17.2)
minitest (2.5.1)
mocha (0.10.0)
multi_json (1.0.4)
mysql (2.8.1)
mysql2 (0.3.11, 0.2.7)
net-ldap (0.2.2)
polyglot (0.3.3)
rack (1.3.5, 1.1.2)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.3, 2.3.14)
railties (3.1.3)
rake (0.9.2.2)
rdoc (3.9.4)
rmagick (2.13.1)
ruby-debug-base19 (0.11.26, 0.11.25)
ruby-debug19 (0.11.6)
ruby-mysql (2.9.4)
ruby-openid (2.1.4)
ruby_core_source (0.1.5)
rubygems-update (1.8.12)
rubytree (0.5.2)
shoulda (2.11.3, 2.10.3)
sprockets (2.0.3)
sqlite3 (1.3.5, 0.1.1)
sqlite3-ruby (1.3.3, 1.2.5)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
I need Rails in order to run chiliproject, but when running the following command
RAILS_ENV=production bundle exec rake db:migrate
I get:
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
cannot load such file -- mysql
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Now with --trace:
RAILS_ENV=production bundle exec rake db:migrate --trace >> tmp/rake
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
cannot load such file -- mysql
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/kernel/requires.rb:7:in `block in require_library_or_gem'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/kernel/requires.rb:5:in `require_library_or_gem'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/mysql_adapter.rb:61:in `mysql_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `block (2 levels) in checkout'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `block in checkout'
/usr/local/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection'
/var/www/html/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:218:in `quoted_left_column_name'
/var/www/html/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:94:in `acts_as_nested_set'
/var/www/html/chiliproject/app/models/issue.rb:33:in `'
/var/www/html/chiliproject/app/models/issue.rb:15:in `'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:291:in `require_or_load'
/var/www/html/chiliproject/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb:133:in `require_or_load_with_engine_additions'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:451:in `load_missing_constant'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:106:in `const_missing_with_dependencies'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:118:in `const_missing'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/inflector.rb:375:in `const_get'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/inflector.rb:375:in `block in constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/inflector.rb:374:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/inflector.rb:374:in `constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:157:in `observed_class'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:183:in `observed_classes'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:166:in `initialize'
/usr/local/lib/ruby/1.9.1/singleton.rb:141:in `new'
/usr/local/lib/ruby/1.9.1/singleton.rb:141:in `block in instance'
:10:in `synchronize'
/usr/local/lib/ruby/1.9.1/singleton.rb:139:in `instance'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:38:in `block in instantiate_observers'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:36:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.14/lib/active_record/observer.rb:36:in `instantiate_observers'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:15:in `block in define_dispatcher_callbacks'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:182:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:182:in `evaluate_method'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:166:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:90:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:90:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:90:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/callbacks.rb:276:in `run_callbacks'
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/initializer.rb:631:in `prepare_dispatcher'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/initializer.rb:185:in `process'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/initializer.rb:113:in `run'
/var/www/html/chiliproject/config/environment.rb:39:in `'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `block in require'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:in `new_constants_in'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/tasks/misc.rake:4:in `block in '
/usr/local/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/usr/local/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/usr/local/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/usr/local/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/usr/local/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/local/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/usr/local/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/usr/local/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/usr/local/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/usr/local/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/usr/local/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/usr/local/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/usr/local/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/usr/local/bin/rake:32:in `'
Tasks: TOP => db:migrate => environment
Does anyone knows what's wrong with mysql gem files?
I also tried to install mysql gem files like this
gem install ruby-mysql2 --no-rdoc --no-ri -- --with-mysql-config=/usr/bin/mysql_config
I was just having similar problems and you may be doing what I was: I was using 'gem list' to determine what was installed (it lists *** LOCAL GEMS *** just like you show) and I saw mysql, but the Gemfile for my project was not requiring bundler to install mysql.
If you just type bundle show does it list 'mysql'? If not, then the Gemfile in chiliproject is not causing bundler to install mysql. I found this all very confusing until I realized I was confusing different ways of managing what gems are installed.
If you or others who comes this way are having the same issue, then perhaps this is helpful. (And perhaps this poor explanation will encourage one of the rails gurus to elaborate for us.)
To say it another way, the list of your locally installed gems, isn't the same as the list installed in your app's bundle of gems (hence where the name of the bundler tool comes from). When you're running your app, and managing its dependencies with bundler you have to do everything within the bundler scope, in order to make sure it all works together. When you do that it's actually very straight forward and solves a lot of problems for you, but if you're coming from previous experience on apps that didn't use bundler then it just takes a little getting used to.
2 steps that worked for me:
Copy the file libmySQL.dll from /libhttp://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick (in the folder /lib/) in c:/your/path/to/ruby/bin (Make sure your ruby bin is in your system PATH environnement variable)
The Default setup is given for MySQL with ruby1.8. If you're running Redmine with MySQL and ruby1.9, replace the adapter name with mysql2 in your /config/database.yml file
http://www.redmine.org/issues/10566
Just on bundle install try this >>
bundle install --without=test development sqlite postgres mysql rmagick
This will install all required base dependencies, the mysql2 database adapter
Cause mysql adapter is not compatible with Ruby 1.9
And don't forget to change config/database.yml --> s/mysql/mysql2
\o/

undefined local variable or method `acts_as_voteable' for

Disclaimer: I'm a Ruby on Rails newbie. Tried Googling and searching StackOverflow without success.
I am creating my first Ruby on Rails app and would like to take advantage of the "thumbs_up" plugin which is similar to vote_fu and acts_as_voteable and works under Rails 3.
https://github.com/brady8/thumbs_up
I have followed the installation instructions on the page above and when I run "gem list" I see the thumbs_up plugin is installed.
I have attempted to add the "acts_as_voteable" mixin to a model which looks like this:
class Foo < ActiveRecord::Base
validates :title, :presence => true
validates :description, :presence => true
acts_as_voteable
end
When I try to browse my app I receive the following error:
undefined local variable or method `acts_as_voteable' for #
The stacktrace does not look very useful to me:
activerecord (3.0.0)
lib/active_record/base.rb:1016:in
method_missing' app/models/foo.rb:7
activesupport (3.0.0)
lib/active_support/dependencies.rb:454:in
load' activesupport (3.0.0)
lib/active_support/dependencies.rb:454:in
load_file' activesupport (3.0.0)
lib/active_support/dependencies.rb:591:in
new_constants_in' activesupport
(3.0.0)
lib/active_support/dependencies.rb:453:in
load_file' activesupport (3.0.0)
lib/active_support/dependencies.rb:340:in
require_or_load' activesupport
(3.0.0)
lib/active_support/dependencies.rb:491:in
load_missing_constant' activesupport
(3.0.0)
lib/active_support/dependencies.rb:183:in
const_missing' activesupport (3.0.0)
lib/active_support/dependencies.rb:181:in
each' activesupport (3.0.0)
lib/active_support/dependencies.rb:181:in
const_missing' activesupport (3.0.0)
lib/active_support/dependencies.rb:503:in
load_missing_constant' activesupport
(3.0.0)
lib/active_support/dependencies.rb:183:in
const_missing' activesupport (3.0.0)
lib/active_support/dependencies.rb:181:in
each' activesupport (3.0.0)
lib/active_support/dependencies.rb:181:in
const_missing'
app/controllers/foos_controller.rb:5:in
`index'
Any ideas? I can't seem to make any progress on resolving this.
Thank you,
-Rob
Try adding an initializer file
# config/initializer/thumbs_up.rb
require 'thumbs_up'
Or you could just require it from your model
# app/models/foo.rb
require 'thumbs_up'

Resources