Articles tagged 'ruby'

  • 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 →

  • Updating and/or uninstalling all installed gems

    October 8, 2011


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


    I like to have an rvm gemset (see more about rvm) with the latest versions of all gems and I usually use this as my sandbox for testing out the latest features and issues of the gems. To update one gem to it’s latest stable version, you just have to run this:

    gem update GEMNAME
    

    The only problem is that for updating every gem you have installed, you have to remember each and every gem you have installed to pass it to the command… Nah, I’m just kidding. Just run the following command, and you’ll be fine:

    gem update `gem list | cut -d ' ' -f 1`
    

    UPDATE

    To uninstall all installed gems, it’s the same command with uninstall instead of update, like this:

    gem…

    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 →

  • RubyMine vs. Vim: my point of view

    September 18, 2011


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


    So, I tweeted a question earlier today about what editor is preferred by the rubyists and, although I didn’t get many answers, it, combined with a recent discussion I had about RubyMine vs. Vim later, helped me clear my reasoning a bit.

    By my reading of Agile Web Development With Rails and some people I follow on twitter, it seems that all the cool geeks use Vim (or TextMate or Emacs) for Ruby and Ruby on Rails programming instead of any IDE.

    I once googled to find out that vim was way complicated to set up. That same time, I found akitaonrails vimfiles on github. Fairly easy to set up if you just follow the instructions. But today I realized that there…

    Continue Reading →