Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeRay throws error in Rails console

I'm running Rails 4 and whenever I try running anything in the rails console, I get the following error:

2.0.0 (main):0 > User.first
CodeRay::Scanners::Scanner::ScanError:

***ERROR in scanner.rb:333:in `raise_inspect': no implicit conversion of Array into String (after  tokens)

tokens:


current line: 1  column: 5  pos: 4
matched: nil  state: "Error in CodeRay::Scanners::Ruby#scan_tokens, initial state was: :initial"
bol?: false,  eos?: false


surrounding code:

nil ~~ ".first"

ERROR

from /Users/silasjmatson/.gem/ruby/2.0.0/gems/coderay-1.1.0/lib/coderay/encoders/terminal.rb:145:in `text_token'

2.0.0 (main):0 >

My Gemfile.lock is like so:

GIT
  remote: git://github.com/gregbell/active_admin.git
  revision: abb3d454d3a6cb0852be6e7aa4c289ba83e1a966
  branch: master
  specs:
    activeadmin (1.0.0.pre)
      arbre (~> 1.0)
      bourbon
      coffee-rails
      devise (~> 3.0)
      formtastic (~> 2.3.0.rc2)
      inherited_resources (~> 1.3)
      jquery-rails
      jquery-ui-rails
      kaminari (~> 0.13)
      rails (>= 3.2, < 4.1)
      ransack (~> 1.0)
      sass-rails

PATH
  remote: components/api
  specs:
    api (01.0)
      rest-client

PATH
  remote: components/data_models
  specs:
    data_models (0.0.1)
      carrierwave
      fog
      mini_magick
      rails (~> 4.0.0)
      unf

PATH
  remote: components/store
  specs:
    store (0.0.1)
      activemerchant
      coffee-rails (~> 4.0.0)
      compass-blueprint
      compass-rails (~> 2.0.alpha.0)
      country_select
      crummy
      devise (~> 3.1.0)
      devise-async
      geocoder
      heroku-deflater
      jquery-rails
      rails (~> 4.0.1)
      sass-rails (~> 4.0.0)
      sidekiq
      sidekiq-failures
      simple_form
      sinatra
      slim-rails (~> 2.0.1)
      turbolinks
      uglifier (>= 1.3.0)

GEM
  remote: http://rubygems.org/
  specs:
    actionmailer (4.0.1)
      actionpack (= 4.0.1)
      mail (~> 2.5.4)
    actionpack (4.0.1)
      activesupport (= 4.0.1)
      builder (~> 3.1.0)
      erubis (~> 2.7.0)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    active_utils (2.0.1)
      activesupport (>= 2.3.11)
      i18n
    activemerchant (1.42.2)
      active_utils (~> 2.0, >= 2.0.1)
      activesupport (>= 2.3.14, < 5.0.0)
      builder (>= 2.1.2, < 4.0.0)
      i18n (~> 0.5)
      json (~> 1.7)
      money (< 7.0.0)
      nokogiri (~> 1.4)
    activemodel (4.0.1)
      activesupport (= 4.0.1)
      builder (~> 3.1.0)
    activerecord (4.0.1)
      activemodel (= 4.0.1)
      activerecord-deprecated_finders (~> 1.0.2)
      activesupport (= 4.0.1)
      arel (~> 4.0.0)
    activerecord-deprecated_finders (1.0.3)
    activesupport (4.0.1)
      i18n (~> 0.6, >= 0.6.4)
      minitest (~> 4.2)
      multi_json (~> 1.3)
      thread_safe (~> 0.1)
      tzinfo (~> 0.3.37)
    addressable (2.3.5)
    arbre (1.0.1)
      activesupport (>= 3.0.0)
    arel (4.0.1)
    asset_sync (1.0.0)
      activemodel
      fog (>= 1.8.0)
    atomic (1.1.14)
    bcrypt-ruby (3.1.2)
    better_errors (1.0.1)
      coderay (>= 1.0.0)
      erubis (>= 2.6.6)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bourbon (3.1.8)
      sass (>= 3.2.0)
      thor
    builder (3.1.4)
    callsite (0.0.11)
    carrierwave (0.9.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
    celluloid (0.15.2)
      timers (~> 1.1.0)
    charlock_holmes (0.6.9.4)
    chunky_png (1.2.9)
    coderay (1.1.0)
    coffee-rails (4.0.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.3)
    compass (0.12.2)
      chunky_png (~> 1.2)
      fssm (>= 0.2.7)
      sass (~> 3.1)
    compass-blueprint (0.0.1)
      compass
    compass-rails (2.0.alpha.0)
      compass (>= 0.12.2, < 0.14)
    connection_pool (1.1.0)
    country_select (1.2.0)
    crack (0.4.1)
      safe_yaml (~> 0.9.0)
    crummy (1.8.0)
    dalli (2.6.4)
    debug_inspector (0.0.2)
    devise (3.1.2)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    devise-async (0.8.0)
      devise (>= 2.2, < 3.2)
    diff-lcs (1.2.5)
    docile (1.1.0)
    dotenv (0.9.0)
    erubis (2.7.0)
    excon (0.28.0)
    execjs (2.0.2)
    factory_girl (4.3.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.3.0)
      factory_girl (~> 4.3.0)
      railties (>= 3.0.0)
    ffi (1.9.3)
    figaro (0.7.0)
      bundler (~> 1.0)
      rails (>= 3, < 5)
    fog (1.18.0)
      builder
      excon (~> 0.28.0)
      formatador (~> 0.2.0)
      mime-types
      multi_json (~> 1.0)
      net-scp (~> 1.1)
      net-ssh (>= 2.1.3)
      nokogiri (~> 1.5)
      ruby-hmac
    foreman (0.63.0)
      dotenv (>= 0.7)
      thor (>= 0.13.6)
    formatador (0.2.4)
    formtastic (2.3.0.rc2)
      actionpack (>= 3.0)
    fssm (0.2.10)
    fuubar (1.2.1)
      rspec (~> 2.0)
      rspec-instafail (~> 0.2.0)
      ruby-progressbar (~> 1.0)
    geocoder (1.1.8)
    growl (1.0.3)
    guard (2.2.4)
      formatador (>= 0.2.4)
      listen (~> 2.1)
      lumberjack (~> 1.0)
      pry (>= 0.9.12)
      thor (>= 0.18.1)
    guard-rspec (4.0.4)
      guard (>= 2.1.1)
      rspec (~> 2.14)
    has_scope (0.6.0.rc)
      actionpack (>= 3.2, < 5)
      activesupport (>= 3.2, < 5)
    heroku-deflater (0.5.2)
      rack (>= 1.4.5)
    hike (1.2.3)
    i18n (0.6.5)
    inherited_resources (1.4.1)
      has_scope (~> 0.6.0.rc)
      responders (~> 1.0.0.rc)
    jquery-rails (3.0.4)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (4.1.0)
      railties (>= 3.1.0)
    json (1.8.1)
    kaminari (0.14.1)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    listen (2.2.0)
      celluloid (>= 0.15.2)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
    lockfile (2.1.0)
    lumberjack (1.0.4)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    meta_request (0.2.8)
      callsite
      rack-contrib
      railties
    method_source (0.8.2)
    mime-types (1.25)
    mini_magick (3.6.0)
      subexec (~> 0.2.1)
    mini_portile (0.5.2)
    minitest (4.7.5)
    money (6.0.0)
      i18n (~> 0.6.4)
    multi_json (1.8.2)
    net-scp (1.1.2)
      net-ssh (>= 2.6.5)
    net-ssh (2.7.0)
    nokogiri (1.6.0)
      mini_portile (~> 0.5.0)
    orm_adapter (0.5.0)
    pg (0.17.0)
    polyamorous (0.6.4)
      activerecord (>= 3.0)
    polyglot (0.3.3)
    pry (0.9.12.3)
      coderay (~> 1.0)
      method_source (~> 0.8)
      slop (~> 3.4)
    pry-rails (0.3.2)
      pry (>= 0.9.10)
    puma (2.6.0)
      rack (>= 1.1, < 2.0)
    rack (1.5.2)
    rack-contrib (1.1.0)
      rack (>= 0.9.1)
    rack-protection (1.5.1)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.0.1)
      actionmailer (= 4.0.1)
      actionpack (= 4.0.1)
      activerecord (= 4.0.1)
      activesupport (= 4.0.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.0.1)
      sprockets-rails (~> 2.0.0)
    rails_12factor (0.0.2)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.1)
    rails_stdout_logging (0.0.3)
    railties (4.0.1)
      actionpack (= 4.0.1)
      activesupport (= 4.0.1)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.1.0)
    ransack (1.1.0)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      polyamorous (~> 0.6.0)
    rb-fsevent (0.9.3)
    rb-inotify (0.9.2)
      ffi (>= 0.5.0)
    rb-readline (0.5.0)
    rdoc (3.12.2)
      json (~> 1.4)
    redis (3.0.6)
    redis-namespace (1.3.2)
      redis (~> 3.0.4)
    responders (1.0.0)
      railties (>= 3.2, < 5)
    rest-client (1.6.7)
      mime-types (>= 1.16)
    rspec (2.14.1)
      rspec-core (~> 2.14.0)
      rspec-expectations (~> 2.14.0)
      rspec-mocks (~> 2.14.0)
    rspec-core (2.14.7)
    rspec-expectations (2.14.4)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-instafail (0.2.4)
    rspec-mocks (2.14.4)
    rspec-rails (2.14.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 2.14.0)
      rspec-expectations (~> 2.14.0)
      rspec-mocks (~> 2.14.0)
    ruby-hmac (0.4.0)
    ruby-progressbar (1.2.0)
    safe_yaml (0.9.7)
    sass (3.2.12)
    sass-rails (4.0.1)
      railties (>= 4.0.0, < 5.0)
      sass (>= 3.1.10)
      sprockets-rails (~> 2.0.0)
    sdoc (0.3.20)
      json (>= 1.1.3)
      rdoc (~> 3.10)
    sidekiq (2.16.1)
      celluloid (>= 0.15.2)
      connection_pool (>= 1.0.0)
      json
      redis (>= 3.0.4)
      redis-namespace (>= 1.3.1)
    sidekiq-failures (0.2.2)
      sidekiq (>= 2.9.0)
    simple_form (3.0.0)
      actionpack (>= 4.0.0, < 4.1)
      activemodel (>= 4.0.0, < 4.1)
    simplecov (0.8.1)
      docile (~> 1.1.0)
      lockfile (>= 2.1.0)
      multi_json
      simplecov-html (~> 0.8.0)
    simplecov-html (0.8.0)
    sinatra (1.4.4)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (~> 1.3, >= 1.3.4)
    slim (2.0.2)
      temple (~> 0.6.6)
      tilt (>= 1.3.3, < 2.1)
    slim-rails (2.0.3)
      actionpack (>= 3.0, < 4.1)
      activesupport (>= 3.0, < 4.1)
      railties (>= 3.0, < 4.1)
      slim (~> 2.0)
    slop (3.4.7)
    sprockets (2.10.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.0.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    sqlite3 (1.3.8)
    subexec (0.2.3)
    temple (0.6.7)
    thor (0.18.1)
    thread_safe (0.1.3)
      atomic
    tilt (1.4.1)
    timers (1.1.0)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (1.3.1)
      coffee-rails
    tzinfo (0.3.38)
    uglifier (2.3.1)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    unf (0.1.3)
      unf_ext
    unf_ext (0.0.6)
    vcr (2.7.0)
    warden (1.2.3)
      rack (>= 1.0)
    webmock (1.16.0)
      addressable (>= 2.2.7)
      crack (>= 0.3.2)

PLATFORMS
  ruby

DEPENDENCIES
  activeadmin!
  api!
  asset_sync
  better_errors
  binding_of_caller
  charlock_holmes
  coderay (~> 1.1.0)
  dalli
  data_models!
  factory_girl_rails
  figaro
  foreman
  fuubar
  growl
  guard
  guard-rspec
  jquery-rails
  meta_request
  pg
  pry-rails
  puma
  rails (= 4.0.1)
  rails_12factor
  rb-readline (~> 0.5.0)
  redis
  rspec-rails
  sdoc
  sidekiq
  simplecov
  sqlite3
  store!
  uglifier (>= 1.3.0)
  vcr
  webmock

Any Help?

like image 460
silasjmatson Avatar asked Nov 20 '13 19:11

silasjmatson


3 Answers

If you're like me and want to keep using pry, changing your Gemfile to have the following fixes this issue.

gem "pry", "0.9.12.2"
like image 151
silasjmatson Avatar answered Nov 14 '22 11:11

silasjmatson


Try removing pry from your Gemfile.

like image 36
Ryan Linton Avatar answered Nov 14 '22 12:11

Ryan Linton


I removed any CodeRay related code from my .pryrc and it works again.

like image 1
sheerun Avatar answered Nov 14 '22 11:11

sheerun