Rolify gem is not working with Rails 3.2.13 - ruby

I am using rails 3.2.13. Before adding rolify into my gemfile the app is working fine. After adding the gem in gem file and run the bundle command, my app is not working it raises the following issue:
ruby-1.9.2-p320#roles/gems/railties-3.2.13/lib/rails/initializable.rb:13:in `[]': can't convert Symbol into Integer (TypeError)
from /home/.rvm/gems/ruby-1.9.2-p320#roles/gems/railties-3.2.13/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

This is the problem with rolify 3.3.0 version gem. If anyone want to use rolify, use below 3.3.0 version presently 3.2.0 is available otherwise it brakes your bones. :)

Related

Error Running Ruby Debug IDE with Rails 4 app

I am having a problem running a Rails 4 app with Ruby Debug IDE using Visual Studio Code. This is the error I get.
/home/ziyan/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:2158:in `method_missing'
: undefined method `this' for #<Gem::Specification:0x1271b08 debase-0.2.1> (NoMethodError)
from /home/ziyan/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:1057:in `find_active_stub_by_path'
from /home/ziyan/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:64:in `require'
from /home/ziyan/.rvm/gems/ruby-2.3.0#tbv_website/gems/debase-0.2.1/lib/debase.rb:4:in `<top (required)>'
from /home/ziyan/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /home/ziyan/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /home/ziyan/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /home/ziyan/.rvm/gems/ruby-2.3.0#tbv_website/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:8:in `<top (required)>'
from /home/ziyan/.rvm/gems/ruby-2.3.0#tbv_website/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide:8:in `require_relative'
from /home/ziyan/.rvm/gems/ruby-2.3.0#tbv_website/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide:8:in `<top (required)>'
from /home/ziyan/.rvm/gems/ruby-2.3.0#tbv_website/bin/rdebug-ide:23:in `load'
from /home/ziyan/.rvm/gems/ruby-2.3.0#tbv_website/bin/rdebug-ide:23:in `<main>'
from /home/ziyan/.rvm/gems/ruby-2.3.0#tbv_website/bin/ruby_executable_hooks:15:in `eval'
from /home/ziyan/.rvm/gems/ruby-2.3.0#tbv_website/bin/ruby_executable_hooks:15:in `<main>'
Extra details
Ruby 2.3.0
Ruby Debug IDE 0.6
IDE: Visual Studio Code + vscode-ruby
Different variations tried
Tried updating to Ruby 2.3.3
Tried downgrading ruby-debug-ide to 0.5
Tried upgrading ruby-debug-ide to 0.6.1.beta4
With no success
Extra
I started a new Rails 5 + Ruby 2.4.0 project and debugging works fine with it. It uses the same ruby-debug-ide version. So the version of ruby-debug-ide should be working.
I just solved the issue by updating rubygems to version 2.6.11 (I think it's the latest version available as of today).
$ gem update --system
Now debugging in VSCode works again.
My current config.
CentOS 7
RVM, latest stable
VSCode, latest stable with Ruby extension 0.10.4
Rails 4 - Ruby 2.3.3 (currently working on a Solidus-based e-commerce)
Debase 0.2.1, Ruby-Debug-IDE 0.6.1b4
I hope this will help you.

rb-appscript stopped working with Ruby 2.0.0 - patch ideas to make it work again?

I know that rb-appscript is officially no longer supported.
However, I tried and found that rewriting existing libraries to use alternative methods (e.g. osascript) was a non-trivial work and it occurred to me that monkey-patching rb-appscript to work again seemed like a better approach, if ever possible.
Here's what happens.
$ rvm 2.0.0
$ gem install rb-appscript
$ irb
> require 'appscript'
LoadError: cannot load such file -- _aem/mactypes
from ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from ruby-2.0.0-p0/gems/rb-appscript-0.6.1/lib/appscript.rb:8:in `<top (required)>'
from ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `require'
from ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:in `require'
What change in Ruby 2.0.0 is causing this?
It seems that there was a bug in Rubygems 2.0.0, and upgrading to 2.0.2 by
gem update --system
fixed the problem.

Why do I get error "undefined method `write_inheritable_attribute'" in my migration?

I attempted to generate a migration like:
rails generate migration RemovefromGenotypes box:integer well:string
but then I get this error:
/usr/share/rails-ruby1.8/railties/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:90:in `<class:Base>'
from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:85:in `<module:Generator>'
from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:48:in `<module:Rails>'
from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:6:in `<top (required)>'
from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/share/rails-ruby1.8/railties/lib/rails_generator.rb:34:in `<top (required)>'
from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/share/rails-ruby1.8/railties/bin/rails:14:in `<main>'
I have no clue where to start to debug this, but would certainly appreciate it if anyone could point me in the right direction...
Thanks!
--rick
Happened to me while installing rails 2.3.14 after rails 3.2.6
It seems rails 2.3 overwrites some rails 3 files. Fixed by removing 2.3 and reinstalling 3.2
I have same issue. Use following command and problem gone
gem install rails
This will install updated rails and all thing working find again.

Inability to find a required service_manager gem

I'm working on some cucumber tests from The Cucumber Book. I've got the code that tries to use a transaction processor and there is a file with the following code:
require 'service_manager'
ServiceManager.start
This is on Mac OS X 10.6.8 using Ruby 1.9.2. When this file executes, I get the following:
no such file to load -- service_manager (LoadError)
/opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
/opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
/opt/local/lib/ruby1.9/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/Users/gpollice/MyCucumber/ATMBookExample/features/support/services.rb:6:in `<top (required)>'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/cucumber-1.1.2/lib/cucumber/rb_support/rb_language.rb:143:in `load'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/cucumber-1.1.2/lib/cucumber/rb_support/rb_language.rb:143:in `load_code_file'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/cucumber-1.1.2/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
The service_manager gem is installed in /opt/local/lib/ruby1.9/gems/1.9.1/gems as are other gems that the application uses. Until I added the code for this iteration, there were no problems. I've looked for reasons why the gem is not found and just can't figure out why. Any help would be appreciated.
It appears to be a load path issue.
Is require "rubygems" invoked prior to this require statement?
Also, if you're using bundler, you have to add this gem to your Gemfile, as bundler attempts to sandbox your dependencies. If you're using bundler, try the following after adding the gem to the Gemfile:
bundle exec rake cucumber

uninitialized constant Rake::DSL in Ruby Gem

I have been working on updating my gem (whm_xml at https://github.com/ivanoats/whm_xml_api_ruby ) to make it work with ruby 1.9.2, latest rubygems, latest bundler, latest rdoc, latest rake. It works fine in 1.8.7 but has the "uninitialized constant Rake::DSL" error only in 1.9.2 . I thought that rake 0.9.2 fixed that but maybe not? I have read a lot on StackOverflow but am still stuck. Any ideas on where to look?
ivan:~/Development/ruby/whm_xml_api_ruby [git:master+] → bundle exec rake -T
(in /Users/ivan/Development/ruby/whm_xml_api_ruby)
rake aborted!
uninitialized constant Rake::DSL
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (required)>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rdoc-3.6.1/lib/rdoc/task.rb:37:in `require'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rdoc-3.6.1/lib/rdoc/task.rb:37:in `<top (required)>'
/Users/ivan/Development/ruby/whm_xml_api_ruby/Rakefile:3:in `require'
/Users/ivan/Development/ruby/whm_xml_api_ruby/Rakefile:3:in `<top (required)>'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373:in `load'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/Users/ivan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rake.rb:1991:in `run'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/ivan/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
This SO Question might help you out. The suggestion there is to add require 'rake/dsl_definition' above require 'rake' in your Rakefile.
I think this is something that happened with the rake 0.9.0 release. Try putting this in your Gemfile: gem 'rake', '0.8.7'
Update
You could try adding
include Rake::DSL if defined?(Rake::DSL)
to your app; it worked for my Rails app at one point.
I fooled around with the include Rake::DSL, etc and just got other errors.
adding
gem 'rake', '0.8.7'
to the Gemfile seems to work for me
I had the same problem with 0.9.1, installed the 0.9.2 and it worked but the db:migrate command sent a message WARNING: Global access to Rake DSL methods is deprecated. Please....
it got solved adding to the rake file
module ::yourappname
class Application
include Rake::DSL
end
end
and
require 'rake/dsl_definition'
before the .. LoadTask entry

Resources