0
votes

I'm not actually a ruby dev, I'm just trying to get development environment setup from a project and I'm having a world of trouble getting the gems in order so I can load up the server. I do mostly front-end work. Anyways, my error is:

There was an error while trying to load the gem 'ahoy_matey'.
Gem Load Error is: undefined method `hours' for 4:Fixnum

I've been searching google for last two days and can't come across anyone experiencing this issue with "ahoy_matey" gem. I get this error when trying to launch the server or rake migrations.

Ruby 1.9.3

Rails 3.2.13

mysql2 0.3.17

Any help is appreciated.

Full trace:

Bundler::GemRequireError: There was an error while trying to load the gem    'ahoy_matey'.
Gem Load Error is: undefined method `hours' for 4:Fixnum
Backtrace for gem load error is:
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/ahoy_matey-1.1.0/lib/ahoy.rb:43:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/ahoy_matey-1.1.0/lib/ahoy.rb:39:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/ahoy_matey-1.1.0/lib/ahoy_matey.rb:1:in `require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/ahoy_matey-1.1.0/lib/ahoy_matey.rb:1:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:86:in `require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `each'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `block in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `each'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler.rb:102:in `require'
/home/sirtastic/projects/dataraptor/config/application.rb:7:in `'
/home/sirtastic/projects/dataraptor/Rakefile:5:in `require'
/home/sirtastic/projects/dataraptor/Rakefile:5:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/bin/rake:33:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/rake:23:in `load'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/rake:23:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/ruby_executable_hooks:15:in `eval'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/ruby_executable_hooks:15:in `'
Bundler Error Backtrace:
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:90:in `rescue in block (2 levels) in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:85:in `block (2 levels) in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `each'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `block in require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `each'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `require'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler.rb:102:in `require'
/home/sirtastic/projects/dataraptor/config/application.rb:7:in `'
/home/sirtastic/projects/dataraptor/Rakefile:5:in `require'
/home/sirtastic/projects/dataraptor/Rakefile:5:in `'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/ruby_executable_hooks:15:in `eval'
/home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/ruby_executable_hooks:15:in `'
(See full trace by running task with --trace)

    source 'http://rubygems.org'

    gem 'rails', '3.2.13'

    gem 'mysql2'#, '~> 0.3.11'
    gem 'sass-rails', '~> 3.2.3' # Because SCSS is compiled for embedded quoters

    # Gems used only for assets and not required
    # in production environments by default.
    group :assets do
    gem 'coffee-rails', '~> 3.2.1'

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes
    gem 'therubyracer', :platforms => :ruby
    gem 'execjs', :platforms => :ruby

    gem 'uglifier', '>= 1.0.3'
    end

    gem 'jquery-rails', '~> 3.0.4'
    gem 'jquery-ui-rails', '~> 4.0.5'
    gem 'jquery_datepicker'

    group :production do
    gem 'pry', require:false
    end

    group :development, :test do
    gem 'capybara', :require => false
    gem 'database_cleaner', :require => false                # for use with capybara tests
    gem 'factory_girl', '~> 4.1'          # for generating test models
    gem 'factory_girl_rails', require:false
    gem 'forgery'                         # for generating test data
    gem 'pry'
    gem 'pry_debug'
    gem 'pry-nav'
    gem 'spork-rails', platform: [:mswin, :mingw] # Fast rpsec testing on Windows
    #### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###
    end

    group :development do
    gem 'thin'              # Sane development server
    gem 'bullet'            # for identifying areas to speed up database queries
    gem 'meta_request'      # for chrome rails-panel
    gem 'rack-mini-profiler', require:false
    #### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###
    end

    group :test do
    gem 'launchy', :require => false
    gem 'rspec-rails'
    gem "selenium-webdriver", "~> 2.40.0" # for AJAX testing
    gem 'shoulda', :require => false
    gem 'simplecov', :require => false    # Test coverage
    gem 'timecop'
    gem 'vcr', '~> 2.9.3'#'~> 2.5.0'
    gem "webmock", '~> 1.10.2'
    #### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###
    end

    group :dev, :release, :development do
    gem 'better_errors'
    gem 'binding_of_caller' # supports better errors by providing IDE in browser when error occurs
    end

    gem 'activeuuid', '>= 0.5.0'
    gem 'ahoy_matey', '1.1.0'       #needs this exact version in order to output UUIDs consistently. the next version after does not.
    gem 'american_date'             # by default, dates are parsed/formatted with American style
    gem 'angularjs-rails', '~> 1.0.7'
    gem 'attr_encrypted', '~> 1.2'  # encrypt activerecord attributes in db
    gem 'authlogic', '~> 3.2'       # user login
    gem 'aws-sdk'
    gem 'capistrano', require: false# deployment of application
    gem 'capistrano-ext', require: false
    gem 'carrierwave'               # file upload solution
    gem 'daemons'                   # used for running delayed_job jobs
    gem 'encryptor', '~> 1.1'       # handle encryption of ActiveRecord fields
    gem 'exception_notification', '~> 4.0.0'
    gem 'faraday'                   # REST client for interfacing with external APIs
    gem 'faraday_middleware'
    gem 'fog', '~> 1.22'            # for Amazon Web Services cloud storage
    gem 'formatador', '~> 0.2'      # This shouldn't need to be here. It is/was a dependency for fog-core, but it wasn't getting bundled (for some reason), so raking assets:precompile consistently failed. 2014-09-17.
    gem 'haml', '~> 4.0.3'
    gem 'holidays', '~> 2.1.0'
    gem 'httpi', '~> 2.2.7'
    gem 'json', '~> 1.8.1'          # Specified so as to 'safely' conduct an update for the sake of stripe gem (2014-05-21)
    gem 'liquid', '~> 2.5.0'        # rendering templates, such as Marketing::Email::Template
    gem 'mini_magick'               # photo resizing
    gem 'momentjs-rails'
    gem 'multi_xml'
    gem 'paperclip', '~> 3.5.0'     # handle file attachments to activerecord
    gem "paypal-recurring"
    gem 'nested_form'
    gem 'rails3-jquery-autocomplete'# supports autocomplete fields
    gem 'redis'                     # for publishing
    gem 'remotipart', '~> 1.0'      # enables multipart form submissions over ajax
    gem 'ruby-saml', '~> 1.0.0'
    gem 'rvm-capistrano', require: false # for deploying to servers where multiple rubies are available
    gem 'safe_attributes'           # takes care of attribute name collisions w/ ActiveRecord (we use 'delay')
    gem 'savon', '~> 2.7'
    gem "select2-rails"             # makes an autocomplete select box, compatible with x-editable
    gem 'sidekiq', '~> 2.17.0'      # handles background/delayed jobs
    gem 'spreadsheet', require: false
    gem "stripe", '~> 1.11.0'
    gem 'tinymce-rails', '>= 4.0.8' # version 4.0.8 includes important bug fixes
    gem 'transaction_retry'         # Catch mysql deadlock and try again
    gem 'tzip', '~> 0.0.4'          # Find timezone by zip code
    gem 'whenever', require: false  # handles scheduled tasks
    gem 'wicked_pdf'                # creates pdfs from html (is a wrapper for wkhtmltopdf)
    gem 'will_paginate', '~> 3.0'   # paginates index pages for activerecord
    gem 'wkhtmltopdf-binary'        # the backend linux tool that creates pdfs from html using QT Webkit rendering engine
    #### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###

2
Probably missing the activesupport gem... can you add your Gemfile and config/application.rb ?patkoperwas
I have gem activesupport (3.2.13) installed.. working on gemlist for youSirtastic
Added the gemlist to original post. Can't post application.rb, potentially sensitive info?Sirtastic
To be clear, you're getting the error when starting the app with something like rails server or rails console?evanbikes
Rails server via 'rails s'Sirtastic

2 Answers

0
votes

Looks like you might be requiring your bundle before requiring rails. If you have these two lines in your application.rb file, they need to be in this order:

require 'rails/all'

Bundler.require(:default, Rails.env)
0
votes

So I see you're running just rails s. I know this question is old but maybe this might help someone else. So the command you want to be running is:

bundle exec rails s

bundle exec executes a command in the context of the bundle.

This command executes the command, making all gems specified in the Gemfile available to require in Rails.

Essentially, if you would normally have run something like rspec spec/my_spec.rb, and you want to use the gems specified in the Gemfile and installed via bundle install, you should run bundle exec rspec spec/my_spec.rb.

Note that bundle exec does not require that an executable is available on your shell's $PATH.

Source