I have a problem when starting rails console:
Loading development environment (Rails 4.1.1)
cannot load such file -- rubygems/custom_require.rb
Console is running, except that I cannot require any gem. Require in application is okay.
I would like to test in console with any of gems, do you now what is the problem?
Ruby version
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
Thanks.
What version of ruby are you using?
Trying requiring a gem with relative require on the file.
require_relative 'gem_name'
Related
I am using rails 4.1.4, ruby 2.1.2 and rvm.
Gemfile (extract)
gem 'rails-perftest'
gem 'ruby-prof', group: :test
I installed ruby using these commands (in order to apply patch which enables memory profiling)
rvm get stable
rvm reinstall 2.1.2 --patch railsexpress
But still no luck and memory reports are empty with rake test:benchmark or rake test:profile
I was trying to get the same Ruby patch and version working with a Rails 3 benchmark and that was broken too, albeit in a different way. It looks to me like this is an oversight in Rails. I'm seeing this warning string on a Rails 3.2 app
$ bundle exec rake test:benchmark
Update your ruby interpreter to be able to run benchmarks.
$ bundle exec rails -v
Rails 3.2.21
The problem seems to be that ActiveSupport 3.2 isn't aware of Ruby versions higher that 2.0 for this particular piece of code
if RUBY_VERSION.between?('1.9.2', '2.0')
require 'active_support/testing/performance/ruby/yarv'
elsif RUBY_VERSION.between?('1.8.6', '1.9')
require 'active_support/testing/performance/ruby/mri'
else
$stderr.puts 'Update your ruby interpreter to be able to run benchmarks.'
exit
end
see https://www.omniref.com/ruby/gems/activesupport/3.2.12/symbols/ActiveSupport::Testing::Performance::Metrics::CpuTime#line=145
After editing the version check manually I can confirm that the patch does work in Rails 3 with version 2.1.2. Perhaps you could check your RUBY_VERSION and RUBY_ENGINE constants for anything unusual?
(I understand this isn't really an answer but I don't have enough reputation to comment. Also it hopefully rules out the rvm patch and ruby-prof as a problem)
My heroku app is crashing because it can't find the module 'SecureRandom'. I am specifying my Ruby version in the gemfile, and my computer, gemfile and Heroku all seem to match Ruby version numbers, though not the patch numbers.
Other posts have suggested pointing usr/bin/heroku to a specific Ruby file, but I'm not sure how to do that (I have no Heroku bin in my app). This does seem like a Ruby version error. How can I try to fix this?
class OrderItem < ActiveRecord::Base
require 'SecureRandom'
...
end
Heroku log:
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require': No such file to load -- SecureRandom (LoadError)
Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
Command line:
/ $ heroku run ruby -v
Running `ruby -v` attached to terminal... up, run.9318
ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-linux]
/ $ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin12.5.0]
Thanks in advance.
The actual name is securerandom, all lowercase. Linux filesystems are usually case sensitive.
So, change your require to:
require 'securerandom'
I have a rails application running rails 3.0.20 and ruby 1.8.7
i want to upgrade to 1.9.3.
the stages i toke in order to start the process are so:
rvm user ruby-1.9.3
rvm gemset create upgradegems
rvm use ruby-1.9.3#upgradegems
now... i ran bundle. and i have a conflict with the twitter gem and the omniauth gem
so i updated them both.
then ran bundle again and it succeeded
now what?..
i tried running
rails s
and i got this error:
ruby-1.9.3-p194#amazonto/gems/aws-s3-0.6.2/lib/aws/s3/extensions.rb:206:in `const_missing_from_s3_library': uninitialized constant Gattica::Auth::VERSION (NameError)
what am i doing wrong? and how do i fix?
thanks
Its not really your code, but its the library you are using Gattica, it wasn't updated for three years, try to put this on your Gemfile
gem "gattica", :git => "https://github.com/chrisle/gattica.git"
That's a fork that works great with ruby 1.9.x
I am trying to set my machine up so I can follow this tutorial: the intro to rails screen-cast i wish i had.
I keep running into issues, most recently the following:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/ansi-1.4.1/lib/ansi/code.rb:5:in `require':
no such file to load -- Win32/Console/ANSI (LoadError)
This occurs when ever I run rails g. (I would like to see if my r spec generator has been added.)
Environment details: Windows 7, ruby 1.9.2p290, rails 3.1.1, rubygems 1.8.15
After you installed "gem install win32console", can you add this gem into your Gemfile file and try to run bundle install again?
Gemfile
gem "win32console", "~> 1.3.0"
RailsInstaller may be your best bet if you're looking for an integrated Windows Rails experience.
It's up-to-date (-ish, doesn't use Ruby 1.9.3) with:
Ruby 1.9.2-p290
Rails 3.1.1
Git 1.7.6
and other useful bits.
I made a change to my shell profile and now when I try to run the Rails console on a Rails app I created, I get this message:
Loading development environment (Rails 2.3.4)
Rails requires RubyGems >= 1.3.2 (you have 1.0.1). Please `gem update --system` and try again.
However, when I run gem -v the output is 1.3.5. What happened here, and how do I fix it? I already renamed the gems version (along with Ruby 1.8.6 and Rails 1.2.6) that came with Leopard to "gem.orig". I added a debug to the Rails initializer and for some reason require 'rubygems' is loading v1.0.1 and not the installed version? How do I fix this? It happened all of a sudden when I changed my shell and configuration.
You probably need to re-set RUBYOPT for the new shell. Details are in the Gems documentation.