Set Up An Ubuntu Local Development Machine For Ruby On Rails

Advertisement

So, you want to develop Ruby on Rails applications? While loads of (introductory) tutorials are available for developing Ruby on Rails applications, there seems to be some uncertainty about setting up a lean and up-to-date local development environment.

This tutorial will guide you through the steps of setting up an Ubuntu local development machine for Ruby on Rails. Part 2 of this tutorial, which will be published here later, will help you through the steps to set up an Ubuntu VPS. For now, knowing that VPS stands for virtual private server is sufficient. It will be able to host your newly developed Ruby on Rails applications. But let’s focus on the local development machine first.

Frontpage Image1

Ruby On Rails? Ubuntu?

What are Ruby on Rails and Ubuntu? In short, Ruby on Rails is a Web development framework that lets you create Web applications using the Ruby programming language. As the official website2 states, “Ruby on Rails is an open-source Web framework that’s optimized for programmer happiness and sustainable productivity. It lets you write beautiful code by favoring convention over configuration.”

Ubuntu213, meanwhile, is a “Debian-derived Linux distribution that focuses on usability.” It has been the most popular Linux distribution for the last couple of years. And even better, both Ruby on Rails and Ubuntu are open source and, therefore, completely free to use.

The Ubuntu Logo4

A Quick Overview

In this tutorial, we’ll install Ruby and RubyGems using the Ruby Version Manager (RVM) script. And we’ll install Rails and Capistrano in turn using RubyGems. The machine will also feature version control, provided by Git and a PostgreSQL database. A fresh installation of Ubuntu and a working Internet connection are assumed, but these steps should work on most (Debian- and Ubuntu-based) Linux distributions.

At the time of writing, the latest versions are Ubuntu 10.10, Ruby 1.9.2 and Rails 3.0.7. This tutorial was also tested on Ubuntu 10.04 and the upcoming Ubuntu 11.04 release.

During this tutorial, we will make extensive use of the Linux command line. Therefore, I have added a small glossary at the end of this article describing the relevant Linux commands.

Getting Up To Date

First, let’s get up to date. Log into your machine as a user with administrative (or sudo) rights, and open a terminal window. The commands rendered below need to be entered in this terminal window. The dollar sign ($) is your command prompt, and the rest is as simple as typing the command and hitting “Enter.”

The first three commands will then update the package lists, upgrade currently installed packages, and install new packages and delete obsolete packages. This will give you a machine that is fully up to date. The final command will reboot the machine, which is good practice after updating a large number of packages.

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo reboot

Prepare Your Machine For RVM

After the machine has rebooted, log back in and open a terminal window. The RVM script needs some packages in order to be installed, namely Curl and Git. Curl is a tool to transfer data using a range of protocols (such as HTTP and FTP). And “Git305 is a free and open-source distributed version control system, designed to handle everything from small to very large projects with speed and efficiency.” Git is the choice for version control among most Ruby on Rails developers.

$ sudo apt-get install curl
$ sudo apt-get install git-core

The Git Logo6

Configure Git

Git will be used by the RVM script, and we’ll be using it in part 2 of this tutorial. So, after installing the packages, let’s take a little time to configure it. Configuring Git is easy: just provide a user name and email address.

$ git config --global user.name "Your Name"
$ git config --global user.email your-email@address.com

For example:

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@mail.com

Install RVM

Now we can install RVM. RVM227 stands for Ruby version manager and “is a command-line tool that allows you to easily install, manage and work with multiple Ruby environments, from interpreters to sets of Gems.” The following command takes care of the installation of the script. RVM will get installed in the home directory of the currently logged-in user.

$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

The RVM Logo8

Navigate to the home directory, and edit the user bash profile. This ensures that the RVM script gets loaded every time the corresponding user logs in. To edit the bash profile, we’ll use Nano. Nano is a simple command-line text editor, and we will use it again in this tutorial.

$ cd
$ nano .bashrc

Add the following line to the end of the user bash profile. After you have made the changes, save the file by pressing CTRL + O, and exit Nano by pressing CTRL + X. If you ever want to exit Nano without saving changes, hit CTRL + X and then N.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Manually load the script into the current shell session with the following command or open a new terminal window. This way, the rvm command will be made available.

$ source .bashrc

You can verify whether the RVM script is working by entering the following command:

$ type rvm | head -1

If everything is set up correctly, the shell should return that rvm is a function. If it doesn’t, go over to the RVM website and look under “Troubleshooting your install9” to see what you can do to make it work.

Prepare Your Machine For Ruby And RubyGems

RVM comes with a handy command to view the dependencies that are needed to compile and install Ruby and RubyGems from source.

$ rvm notes

See the dependencies listed under the regular version of Ruby, and install these. Some packages might already be installed.

$ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev

Install Ruby And RubyGems Using RVM

First, we have Ruby2310, “a dynamic, open-source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.”

Then we have RubyGems2411. This is “the premier Ruby packaging system. It provides a standard format for distributing Ruby programs and libraries, an easy-to-use tool for managing the installation of Gem packages, a Gem server utility for serving Gems from any machine where RubyGems is installed, and a standard way of publishing Gem packages.”

The Ruby Logo12

Like the RVM command described above, there is also a command to see what versions of Ruby are available for installation using RVM. Have a look at the available Ruby versions using this command:

$ rvm list known

Install a regular version of Ruby. Because Ruby gets compiled from source, this step might take a while.

$ rvm install 1.9.2

Start using the installed Ruby, and set this version as a default.

$ rvm --default use 1.9.2

Check the Ruby and RubyGems versions to see whether they have been properly installed.

$ ruby -v
$ gem -v

If necessary, manually updating RubyGems and the Gems is possible.

$ gem update --system
$ gem update

Install Rails Using RubyGems

Rails Gem itself is all that’s left for Ruby to be put on Rails. Installing this is one of the easiest parts of this tutorial. It is installed using RubyGems, invoked by the gem command. When the installation finishes, check the Rails version to see whether Rails has been properly installed.

$ gem install rails
$ rails -v

The Rails Logo13

Install Capistrano Using RubyGems

Capistrano2614 is “an open-source tool for running scripts on multiple servers. Its main use is deploying Web applications. It automates the process of making a new version of an application available on one or more Web servers, including supporting tasks such as changing databases.” You can install Capistrano using RubyGems. Check the Capistrano version to see whether it has been properly installed.

$ gem install capistrano
$ cap -V

Install PostgreSQL

PostgreSQL2915 is “a sophisticated object-relational DBMS, supporting almost all SQL constructs, including subselects, transactions, and user-defined types and functions.” Install PostgreSQL together with a dependency. This dependency is needed to install the pg Gem later on, which is responsible for the connection between PostgreSQL and Ruby on Rails.

$ sudo apt-get install postgresql libpq-dev

The PostgreSQL Logo16

Configure PostgreSQL

When the packages have been installed, move on to configuring PostgreSQL by securing pSQL. pSQL is the PostgreSQL interactive terminal, and it is used for administrative database tasks.

By default pSQL does not require a password for you to log in. We’ll change this by editing the authentication method and then reloading the PostgreSQL configuration. But first, assign a password to super-user postgres. Log into pSQL, assign a safe password to postgres, and then log out of pSQL.

$ sudo -u postgres psql
# password postgres
# q

Now modify the authentication configuration by changing ident to md5. This ensures that a password is needed to log into pSQL and that the password is encrypted. The two lines that need to be edited can be found near the end of the configuration file. After that, reload the changed configuration into PostgreSQL.

$ sudo nano /etc/postgresql/8.4/main/pg_hba.conf
$ sudo /etc/init.d/postgresql reload

Most other PostgreSQL settings are stored in another configuration file. These settings can also be optimized, but that is beyond the scope of this tutorial. Keep in mind that a reload of the PostgreSQL configuration is required in order for changes to become active.

$ sudo nano /etc/postgresql/8.4/main/postgresql.conf

The installation of the local development machine is now done.

Testing The Set-Up

To make sure everything works, let’s develop a really small application and see a bit of Ruby on Rails in action. This process covers the following steps:

  • Create a database user for the test application,
  • Create a database for the test application,
  • Create a test application using PostgreSQL as the database,
  • Install the necessary Gems for the test application,
  • Configure the database connections for the test application,
  • Generate a simple scaffold for the test application,
  • Migrate the results of the scaffold to the test application database,
  • Start the built-in server,
  • Check the test application in a Web browser,
  • Stop the built-in server.

Once we have verified that everything works, we go through the following steps:

  • Delete the database for the test application,
  • Delete the database user for the test application,
  • Remove the test application.

All of these steps should be performed on the local development machine. The conventions used to test the VPS are as follows (the database user name and database name derive from the name of the application):

Box 1.1

Name of application: test_app

Name of database user: test_app

Password of database user: apple

Name of database: test_app_development

First, create a database user for the test application using the createuser command. We are using postgres as the admin (or super-user) for PostgreSQL. The P flag allows us to provide a password. The > sign stands for the questions that will be prompted.

$ sudo -u postgres createuser -P
> Enter name of role to add: test_app
> Enter password for new role: apple
> Enter it again: apple
> Shall the new role be a superuser? (y/n) n
> Shall the new role be allowed to create databases? (y/n) n
> Shall the new role be allowed to create more new roles? (y/n) n
> Password: your-postgres-user-password

Then, create a database for the test application that is owned by the test application user. While we could use Rake to create a database, we will use PostgreSQL, so that we learn some basic PostgreSQL administration. Create a new database by invoking the createdb command in conjunction with the O flag, the database user name and the new database name itself. The addition of development at the end makes it the default database name. Here, you will be prompted for the PostgreSQL super-user password again.

$ sudo -u postgres createdb -O test_app test_app_development
> Password: your-postgres-user-password

Now that the database has been set up, it is time to create the actual Ruby on Rails application. Navigate to your home directory, and create a new Rails application, named test_app, using PostgreSQL as the database back end. The d flag allows us to specify the preferred database software.

$ cd
$ rails new test_app -d postgresql

Go into the Rails application directory, and install the necessary Gems using Bundler. Bundler2717 takes care of “an application’s dependencies through its entire life across many machines systematically and repeatably,” and it “works out of the box with Rails 3.”

$ cd test_app
$ bundle install

Use Nano to edit the database configuration file by adding apple as a password under the development database configuration. Because we have followed convention, described in Box 1.1 above, the database user name and database name have already been taken care of.

$ nano config/database.yml

Now generate a basic scaffold. This will create a User model and a users controller. The inputs will consist of a name and an email address, which are both strings in the PostgreSQL database.

$ rails generate scaffold User name:string email:string

Use Rake2818 to migrate the scaffold to the development database. Rake is an acronym for Ruby Make. It is a “simple Ruby build program with capabilities similar to Make,” which allows you to create and migrate databases.

$ rake db:migrate

By now, it is time to check the (working) application in a Web browser. Start the built-in server, and use a Web browser to navigate to http://localhost:3000/19. In particular, look at the application’s environment, and then look at http://localhost:3000/users20. Create, edit, view and delete some users.

$ rails server

When everything appears to be working correctly, you can stop the built-in server.

$ press CTRL+C

If everything has worked, then the test application database and test application database user can be removed. The dropdb command removes a PostgreSQL database.

$ sudo -u postgres dropdb test_app_development
> Password: your-postgres-user-password

The dropuser command removes a PostgreSQL user.

$ sudo -u postgres dropuser
> Enter name of role to drop: test_app
> Password: your-postgres-user-password

Finally, navigate to your home directory, and recursively remove the test application. This leaves you with a fresh local development machine, ready for developing Ruby on Rails applications.

$ cd
$ rm -r test_app

In part 2 of this tutorial, which will be published here later, we will help you through the steps necessary to set up an Ubuntu VPS that is capable of hosting (multiple) Ruby on Rails applications.

Linux Command Line Glossary

The relevant Linux commands for this tutorial are listed below in alphabetical order. A Linux command usually takes the form of command -option(s) argument(s). For example, rm -r test_app. For a more detailed description, use the manual pages, which can be accessed using man [command].

  • sudo [command]Used to execute a command as an administrative user.
  • apt-get dist-upgradeIn addition to performing the function of upgrade, this is used to intelligently handle dependencies.
  • apt-get install [package]Used to install (or upgrade) packages.
  • apt-get updateUsed to resynchronize the package index files from their sources.
  • apt-get upgradeUsed to install the newest versions of all packages currently installed.
  • bash < <( curl [location] )A combination of commands for obtaining and executing a script (from the Internet).
  • cd [location]Used to change the current working directory. Without an argument, it goes to the user’s home directory.
  • nano [file]Used to edit configuration files.
  • rebootUsed to reboot the system.
  • rm -r [directory]Used to remove a directory (recursively).
  • source [script]Used to force bash to read a specified script.
  • type [command]Used to display the kind of command that the shell will execute.

References

Further Learning

(al)

Footnotes

  1. 1 http://www.smashingmagazine.com/wp-content/uploads/2011/04/bf_frontpage.png
  2. 2 http://rubyonrails.org/
  3. 3 http://www.ubuntu.com/
  4. 4 http://www.smashingmagazine.com/wp-content/uploads/2011/04/bf_ubuntu.png
  5. 5 http://git-scm.com/
  6. 6 http://www.smashingmagazine.com/wp-content/uploads/2011/04/bf_git.png
  7. 7 http://rvm.beginrescueend.com/
  8. 8 http://www.smashingmagazine.com/wp-content/uploads/2011/04/bf_rvm.png
  9. 9 http://rvm.beginrescueend.com/rvm/install/
  10. 10 http://www.ruby-lang.org/
  11. 11 http://rubygems.org/
  12. 12 http://www.smashingmagazine.com/wp-content/uploads/2011/04/bf_ruby.jpg
  13. 13 http://www.smashingmagazine.com/wp-content/uploads/2011/04/bf_rails.jpg
  14. 14 http://capify.org/
  15. 15 http://www.postgresql.org/
  16. 16 http://www.smashingmagazine.com/wp-content/uploads/2011/04/bf_postgresql.png
  17. 17 http://gembundler.com/
  18. 18 http://rake.rubyforge.org/
  19. 19 http://localhost:3000/
  20. 20 http://localhost:3000/users
  21. 21 http://www.ubuntu.com/
  22. 22 http://rvm.beginrescueend.com/
  23. 23 http://www.ruby-lang.org/
  24. 24 http://rubygems.org/
  25. 25 http://rubyonrails.org/
  26. 26 http://capify.org/
  27. 27 http://gembundler.com/
  28. 28 http://rake.rubyforge.org/
  29. 29 http://www.postgresql.org/
  30. 30 http://git-scm.com/
  31. 31 http://linuxcommand.org/
  32. 32 http://linuxcommand.org/tlcl.php
  33. 33 http://guides.rubyonrails.org/
  34. 34 http://ruby.railstutorial.org/
  35. 35 http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
  36. 36 http://book.git-scm.com/
  37. 37 http://progit.org/book/
  38. 38 http://gitref.org/

↑ Back to topShare on Twitter

I'm a Business Administration Master's student from the Netherlands with a passion for typography, web design and web development. In addition to that I'm a fanatic Linux explorer. I know basic HTML, CSS, a bit of PHP and I'm currently eagerly learning Ruby on Rails.

Advertising

Note: Our rating-system has caused errors, so it's disabled at the moment. It will be back the moment the problem has been resolved. We're very sorry. Happy Holidays!

  1. 1

    Great Article… for a part 2 how about setting up a simple Ubuntu Server?

  2. 2

    What about an IDE? Picking the right one is a key piece to learning any language.

    I use Eclipse, with the Aptana Studio 3 plugin for Ruby/Rails support…works brilliantly!

  3. 3

    I also use Aptana for developing! Aptana is a great and powerful open-end IDE for developing.

  4. 4

    nice artikel… thx for sharing..

    How to install NGINX with rails?
    Because I dont like WEBrick and I use Thin web server before it

  5. 5

    Personally, rather than nano .bashrc I just use:

    echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm” ‘ >> ~/.bashrc

    from the command line. Saves a bit of scrolling, copying and pasting. Useful writeup, thanks!

  6. 6

    Excellent!! Just what I wanted.

  7. 7

    That is a possibility indeed, but on this topic I’m with Michael Hartl, author of the Ruby on Rails Tutorial book. In a couple of lines he explains that there are several Rails IDE’s, but that the majority of Rails developers use a text editor to edit text and a command line to issue commands. I personally like this simplicity. If an IDE is working for you, then thats great. In the end its all a matter of taste I guess.

    Please read these sections from his book if you care what he has to say about this:

    IDEs

    Text editors and command lines

  8. 8

    Thank you for the compliment. Regarding your question.. how to install a VPS with Nginx will be explained in part 2 of this tutorial. Most of this will also be applicable on a local development machine.

  9. 9

    You’re absolutely right Dan. I didn’t want to deviate from the “official RVM steps,” but it was changed after I wrote this article. Both methods will do just fine, although yours is shorter.

  10. 10

    I was doing great until ‘gem install rails’ where I started running into

    Installing ri documentation for rails-3.0.9…
    file ‘lib’ not found
    Installing RDoc documentation for rails-3.0.9…
    file ‘lib’ not found

    I tried ‘gem install rdoc’ but that didn’t solve the problem.

    Anyone else run into this?

  11. 11

    right on time!

    ..was preparing my machine for Ruby development and wondering for a better way to manage multiple ruby versions .

    Thanks ( Specially for RVM explanation )

  12. 12

    Joakim Runeberg

    June 21, 2011 9:15 am

    Or you could just use this:

    https://github.com/joshfng/railsready/

  13. 13

    An other interesting is Scribes. Radical concept, but the editor is very polished – better than any other editor I know; even vim and emacs ;)

    http://scribes.sourceforge.net/

    Installation under Ubuntu:
    sudo add-apt-repository ppa:mystilleef/scribes-daily
    sudo apt-get update
    sudo apt-get install scribes

  14. 14

    I get stuck at the rmv command. Doesn’t find it after reloadiing the bash . /home/mhenke/.rvm/scripts/rvm”: No such file or directory

  15. 15

    Jonathan Búcaro

    June 21, 2011 7:25 pm

    Ty so much for sharing! I’m going to install it with VirtualBox :D

  16. 16

    Yeah, I prefer using a text editor too, preferably Emacs and Vim for editing short files. I usually work with a VM and IDEs hog way too much resources :)

  17. 17

    Hi, I am new in Rails. I just pick up as set up development enviroment project called BitNami Rubystack? It is good way or it has some disadvantages?

  18. 18

    Check out Bitnami.org – lots of stacks there that you can spin up on Windows, OSX, Virtual as well.

  19. 19

    using sqlite for development is enough I guess ?

  20. 20

    SQLite is indeed enough for development, but I’m preparing the reader for deploying an application in part two. For deployment it’s preferable to use PostgreSQL or MySQL.

  21. 21

    It is called “rvm,” but I guess you got that part right. Did you edit the .bashrc file? And are you sure you are located in your home directory ($ cd) when you issue the source command?

    Maybe you can check whether that directory is there at all. Go to your home directory ($ cd) and list all of its contents ($ ls -al), is the .rvm directory there? If not.. please install the script again.

  22. 22

    Aptana is/was great! I say that because it use to be well supported. Now it has been bought out (which could be a good thing). I am looking forward to seeing what the new company does with the products. RadRails was one of the best IDE’s IMO. To me, it made the most sense.

  23. 23

    I agree @David. I think you can use sqlite if you are beginning to learn Ruby on Rails. To me though, it makes no sense to move from one database engine to another (development to production). I usually just tend to stick with MySQL (obviously depending on the application).

  24. 24

    What about capistrano. You installed it, but you never mention it in rest of the article

  25. 25

    It’s a preperation for part 2, just like the configuration of Git. Maybe I should have stated that more explicit.

  26. 26

    If you install the bundler gem instead of rails, then you can create your application directory, and a gemfile with rails in it, and then generate your app within the app directory itself without having all of the rails dependencies in your gemset.

    Command will be something like “bundle exec rails new . -d postgres”.

    I actually wrote a blog post about this a couple of weeks ago: http://blog.expectedbehavior.com/2011/06/rvm-rails-bundler-without-the-gemset-pollution-bullshit/

  27. 27

    very good tutorial indeed.
    Thanks for sharing.

  28. 28

    I would recommend using passenger as the default server and if required add passenger as an apache-mod.

  29. 29

    IDE.. not needed. I use gedit.. it’s great.

  30. 30

    Ubuntu is great for developing a ruby app.. One other thing to throw in the mix that will make your life so much more fun: Heroku. It is dead sexy.

  31. 31

    I get the same exact error on both my Windows and Ubuntu server.

  32. 32

    I don’t see that folder in home. I ran the rvm curl commant again and get this output.

    Successfully checked out branch ”
    Current branch master is up to date.
    Successfully pulled (rebased) from origin

    RVM: Shell scripts enabling management of multiple ruby environments.
    RTFM: https://rvm.beginrescueend.com/
    HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)

    Upgrading the RVM installation in /usr/local/rvm//usr/local/rvm /usr/local/rvm/src/rvm
    /usr/local/rvm/src/rvm

    Correct permissions for base binaries in /usr/local/rvm/bin…
    Copying manpages into place.
    RVM system user group ‘rvm’ exists, proceeding with installation.

    Upgrade Notes

    * rvm_trust_rvmrcs has been changed to rvm_trust_rvmrcs_flag for consistency

    * Ruby package dependency list for your OS is given by:
    rvm notes

    * If you encounter any issues with a ruby ‘X’ your best bet is to:
    rvm remove X ; rvm install X

    * If you wish to have the ‘pretty colors’ again, set in ~/.rvmrc:
    export rvm_pretty_print_flag=1

    * If you see the following error message: Unknown alias name: ‘default’
    re-set your default ruby, this is due to a change in how default works.

    Upgrade of RVM in /usr/local/rvm/ is complete.

  33. 33

    Great Job!!!! Thanks a lot.

  34. 34

    Great!
    Could I post a version translated into Portuguese of this tutorial on my blog?

  35. 35

    When creating a database user for the test_app the p flag should be capitalized:

    sudo -u postgres createuser -P

    Otherwise issuing the command as-is will result in the following message:

    /usr/lib/postgresql/8.4/bin/createuser: option requires an argument — ‘p’
    Try “createuser –help” for more information.

  36. 36

    I had to add to .bashrc

    export PATH=~/.rvm/bin:$PATH

  37. 37

    It seems my rvm wasn’t in .rvm it was created here when I did the curl call: /usr/local/rvm

    so in the .bashrc I had to put this

    [[ -s “/usr/local/rvm/scripts/rvm” ]] && . “/usr/local/rvm/scripts/rvm”

  38. 38

    Thanks! Thanks! Thanks! Thanks! Thanks! Thanks! Thanks! Thanks! Thanks!

  39. 39

    this line:
    sudo /etc/init.d/postgresql reload

    for me had to be changed to this one:
    sudo /etc/init.d/postgresql-8.4 reload

  40. 40

    agus @ kiranatama

    December 14, 2011 2:12 am

    I started learning Ruby/Ruby on Rails a couple mount ago and this is exactly how I started it! this is possibly the best way to learn the language IMO. This way you learn everything you could possibly need I even encourage you to ready more about Ruby itself to get more families with the methods you can use!

    agus h

  41. 41

    An IDE? On Linux?

    It is one …

    ;-)

  42. 42

    Awesome step-by-step. Thanks !

  43. 43

    hi can you help me how to configure rails path to set in radrails i have installed rails through rvm

  44. 44

    I was running this on Mint and it failed on:

    bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

    Looking up the documentation at I used this command instead:

    curl -L get.rvm.io | bash -s stable

    Worked fine for me.

  45. 45

    I just created a brand new SC 6.2 site and added the CustomItemGenerator scorue to my solution as another project. I installed the package into my site, then built the scorue to overwrite the package’s CustomItemGenerator.dll. I tried to generate custom item classes for a sample dummy template and the generate button doesn’t seem to do anything still.I checked what the button does in the core and saw it calls devtools:generatecustomitem(id=$Target) so I’m thinking maybe something isn’t hooking in. I looked in the CustomItemGeneratorCommand class and saw that if you try to generate custom items on any items other than a template or template folder, there should be a sheer alert in SC, which I don’t get.

  46. 46

    Thank you!! This is the closest to a one step installer as possible.

  47. 47

    I found

    $ curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

    better for installing RVM

  48. 48

    LOL, SQL is so difficult. Thank god you avoid it in RoR. Thank god it’s all hdedin and in some monolithic framework that basically decides for you what you want to do. I can see why people that like RoR hate C/C++. You actually have to be smart and understand the details to write in C/C++. Who needs that? Just crank out a pre-fab website with RoR. Isn’t that how garbage collection became such a problem??

  49. 49

    Very good article with good choice of applications.
    Thanks

  50. 50

    Can’t seem to resolve the problem below, any ideas?

    paul@paul-Aspire-5920 ~/code/test_app $ rails generate scaffold User name:string email:string
    /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/execjs-1.4.0/lib/execjs.rb:5:in `’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/execjs-1.4.0/lib/execjs.rb:4:in `’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `block (2 levels) in require’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `block in require’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.3.4/lib/bundler.rb:132:in `require’
    from /home/paul/code/test_app/config/application.rb:7:in `’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/railties-3.2.13/lib/rails/commands.rb:24:in `require’
    from /home/paul/.rvm/gems/ruby-1.9.3-p392@rails3.2/gems/railties-3.2.13/lib/rails/commands.rb:24:in `’
    from script/rails:6:in `require’
    from script/rails:6:in `’

    Thanks for your time
    Paul

  51. 51

    try installing therubyracer first – it helped in my case,

    gem install therubyracer

    but then I’m stuck with “Peer authentication failed for user “test_app” and I don’t know what to do :-

  52. 52

    To fix the error “Peer authentication failed for user “test_app””, change the line in /etc/postgresql/9.1/main/pg_hba.conf from:

    local all all peer

    to:

    local all all md5

    which will allow rails to authenticate using the password you supplied in config/database.yml (e.g. apple)

↑ Back to top