Articles tagged 'rails'

  • Rails 3.1 "rails console" fails with "no such file to load -- readline"

    October 12, 2011


    This post was originally published in the Rambling Labs Blog on October 12, 2011.


    Yesterday, I was trying to run the rails console command on Ubuntu with ruby 1.9.2 and rails 3.1, without any success. I was getting a no such file to load -- readline error. This kind of error was sort of familiar for me (I had the common no such file to load -- zlib and the not so common no such file to load -- openssl a while ago). So this was probably another package that I was missing.

    Turns out that as I found in a Stack Overflow question, I needed the libreadline-dev, which I didn’t have installed. But I also needed to recompile ruby, seriously!?

    This is where rvm comes to the rescue, and why I love so much to have rvm installed :D. You only need…

    Continue Reading →

  • Rails 3.1 smtp gmail Errno::ECONNREFUSED Connection refused

    October 9, 2011


    This post was originally published in the Rambling Labs Blog on October 9, 2011.


    I was trying out the rails 3.1 smtp mailer on the sandbox application I use to test all the new stuff and it was throwing this error:

    Errno::ECONNREFUSED in TestController#create
    
    Connection refused - connect(2)
    

    And I had this configuration on config/environments/development.rb:

    Demo::Application.configure do
      # ...
      config.action_mailer.delivery_method :smtp
      config.action_mailer.smtp_settings = {
        enable_starttls_auto: true,
        address: 'smtp.gmail.com',
        port: 587,
        domain: 'gmail.com',
        authentication: 'plain',
        user_name: '<email@yourdomain.com>',
        password: '<password>'
      }
      # ...
    end
    

    I tried quite a number of combinations for…

    Continue Reading →

  • Rails 3.1 "rake db:migrate" fails with "stack level too deep" error

    September 20, 2011


    This post was originally published in the Rambling Labs Blog on September 20, 2011.


    I was trying to run the following command on a new rails 3.1 app and it was failing… badly.

    rake db:migrate
    
    /home/edgar/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
    /home/edgar/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
    /home/edgar/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
    /home/edgar/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
    /home/edgar/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version…

    Continue Reading →

  • Rails 3.1 "rails server" error Could not find a JavaScript runtime

    September 19, 2011


    This post was originally published in the Rambling Labs Blog on September 19, 2011.


    I upgraded to rails 3.1.0 and created a new ‘test_app’.

    rails new test_app
    

    Got into the directory. Everything was fine, until I tried to run:

    rails server
    

    It threw a weird error:

    Could not find a JavaScript runtime.
    See https://github.com/sstephenson/execjs for a list of available runtimes.
    

    That’s kinda weird. What does a rails app have to do with any JavaScript runtime? I guess it’s support for something that I still don’t know anything about.

    I googled that and found a stackoverflow question. So, two solutions for the issue: either*** install nodejs*** or include “gem ‘execjs’” and “gem ‘therubyracer’” in the Gemfile and run bundle install.

    Pick…

    Continue Reading →