Articles tagged 'rails 3.1'

  • Refinery CMS, rails 3.1.1 and the Operation not permitted error Errno::EPERM

    October 14, 2011


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


    The last couple of days, I’ve been trying to set up Refinery CMS for a project I’m working on. I’ve made a couple of Stack Overflow questions about which ruby on rails CMS supports multiple languages and custom types.

    Answers to both questions were directing me to Refinery CMS, so I had to test it out. But… I wanted it to be on rails 3.1 (either 3.1.0 or 3.1.1). So I googled for a while and found that Refinery CMS edge on github does support rails 3.1.

    So I set up my Refinery CMS local test under my Ubuntu virtual machine by first downloading the edge code from github, like this:

    git clone git://github.com/resolve/refinerycms.git ~/refinerycms-edge
    

    Continue Reading →

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

    Continue Reading →

  • Rails 3.1 and the assert_select_jquery

    October 8, 2011


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


    Diving a little into rails 3.1, I’m really liking some of the stuff I’ve found, like the easy Ajax integration for the views and the functional tests to ensure that the behavior of the controllers is the expected one.

    There is one particular method, assert_select_jquery, that I just don’t understand why it works how it works.

    Let’s say you have an Ajax request whose view to return is content.js.erb like this:

    if($('#container').is(':not(:visible)')) $('#container').show('blind', 1000);
    $('#container').html('<%= render @content %>');
    

    Ok, the page renders as expected, but, as you can see, this code is not too great. We’ll talk about that later. So, say...

    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 →