My Secret Life as a Spaghetti Coder
home | about | contact | privacy statement
I could have sworn I had RadRails and Instant Rails working and was able to develop Ruby on Rails applications several months ago. But, I think I had a funktified setup, as yesterday I couldn't get it to work at all.

So, I went looking for what was wrong, and came across Matt Griffith's screencast about how to get started with Rails (in less than 5 minutes!).

The first thing to do was get InstantRails. I already had it, but I downloaded again just in case I had old versions of everything. Then, I followed his easy directions. I've restated them here, since I'm new to this and easily forget.

  1. Unzip Instant Rails where you want it to reside. I chose C:\InstantRails
  2. Start Instant Rails. Click the "OK" button to let it update the configuration file
  3. If IIS is running (you get port 80 is in use by inetinfo.exe, stop IIS by typing iisreset /stop at the command prompt
  4. Open a Ruby console window through Instant Rails by clicking The "I" button -> Rails Applications -> Open Ruby Console Window
  5. You should be in C:\InstantRails\rails_apps. If you are working on a new application, generate it by using the command: rails <project_name>. Matt called his demo, so the command was "rails demo."
  6. Move to the project directory, C:\InstantRails\rails_apps\demo
  7. Generate a controller: ruby script/generate controller <ControllerName>
  8. Generate a model: ruby script/generate model <ModelName>
  9. Create a migration by editing the file: C:\InstantRails\rails_apps\demo\db\migrate\001_create_posts.rb (assuming your model was called Post
  10. In the self.up method in that file, add the columns (one per line). For instance, t.column :title, :string on the first line, then t.column :body, :text (he is using a blog as an example).
  11. Open the configuration file for the database. This is found in C:\InstantRails\rails_apps\demo\config\database.yml. Basically, you can find the names of the databases you are going to need to create. We'll be doing demo_development.
  12. Start Apache to create the database using php administrator interface to MySQL. You can start Apache by clicking on Apache->Start in Instant Rails. Be sure to unblock it if Windows Security asks.
  13. Click I->Configure->Database (via PhpMyAdmin)
  14. That will open a browser to the admin page. Just type in the name of the database and submit the form. Ours is called demo_development.
  15. Stop Apache (in Instant Rails click Apache->Stop)
  16. Start WEBrick: In C:\InstantRails\rails_apps\demo, type the command: ruby script/server. If Windows asks, unblock it. Take note of the port it will be using.
  17. Set up the controller to have something. Open C:\InstantRails\rails_apps\demo\app\controllers\blog_controller.rb. In the class, type scaffold :post
  18. To create the database, run the migration. In C:\InstantRails\rails_apps\demo type the command: rake db:migrate
  19. Now you can go to http://localhost:3000 (or whatever port it is using). Here you'll see the "Welcome Aboard" page from Rails.
  20. To see your application, go to http://localhost:3000/blog. Play around, have fun.
If you are working on an existing application, obviously you can skip several of those steps (like, every one that involves creating a new application).

Now, I'll see about getting RadRails working in the next few days.

Hey! Why don't you make your life easier and subscribe to the full post or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!


Comments
Leave a comment

Sam,
Nice,clear and short configuration. Like it very much. Exactly what i was searching. What about a tiny project after configure? Like to get your advice for start quick.

Posted by Md. Aminul Islam on Apr 19, 2007 at 04:58 AM UTC - 5 hrs

That's not a bad idea. Maybe when I've got some spare time I'll show a quick application that isn't just scaffolding.

Finals are coming up and between trying to finish up school projects and work, I don't see it happening within the next several weeks.

Thanks for the idea!

Posted by Sam on Apr 19, 2007 at 07:56 AM UTC - 5 hrs

hi,
sam
i have just started learning ROR kindly help me if u can bcz im facing lot difficulties in it

malu

Posted by malu on May 17, 2007 at 05:20 AM UTC - 5 hrs

Do you have any specific troubles or questions? I wouldn't know where to start =)

Posted by Sam on May 17, 2007 at 04:40 PM UTC - 5 hrs

I have a few questions. In #17, where did "blog_controller.rb" come from? Also, in #20, what decides that the url will be http://localhost:3000/blog? Where are these references to "blog" coming from? What did I miss?

Posted by John on Aug 13, 2007 at 02:45 PM UTC - 5 hrs

John- Sorry for the confusion. The demo was originally creating a simple blog - basically a place to enter a post and a title for it.

The blog_controller.rb came from step #7, Generate a controller: ruby script/generate controller <ControllerName>

I called mine "blog".

In step 20, the localhost:3000 comes from the fact I set up WEBrick to run on the local box and by default it runs on port 3000. The "blog" part of the URL comes from the way Rails navigates: go to http://<servername>/<controller_name> (the name of your controller - in my case "blog" - without "_controlller" appended) to see the default view for the associated controller (which should be "list").

Does that help any?

Posted by Sam on Aug 13, 2007 at 02:59 PM UTC - 5 hrs

Ok, that makes more sense. Thanks a lot for the prompt reply. :)

Posted by John on Aug 13, 2007 at 03:23 PM UTC - 5 hrs

Luckily I'm not having a very motivated work day. =)

Posted by Sam on Aug 13, 2007 at 03:29 PM UTC - 5 hrs

Clear tutorial...
Worked like a charm. Which i found instant rails sooner, lol. I was installing everything manually.

Posted by Frank on Nov 10, 2007 at 09:36 AM UTC - 5 hrs

It's nice., i learned InstantRails within 20 Mins..But
Can you tell me how much this help to create a big project?
It would be nice if you give some more example web page creation thru Instnat Rails

Posted by Durgaram on Jan 25, 2008 at 12:17 AM UTC - 5 hrs

Unfortunately, I don't think a single blog post can break down all the nuances of a large project. That comes from long term reading, learning, and experience.

I do try to address those principles that lead to it though, so if you stick around it might be helpful. I also recommend the articles at http://butunclebob.com/ArticleS.UncleBob.Principle... as a good start for OO design, which helps in large projects.

Posted by Sammy Larbi on Jan 27, 2008 at 01:51 PM UTC - 5 hrs

Sam,
I had these issues when I installed instant rails on a Windows XP system and crated a rails project:
1) In my project folder the config\database.yml file had the adapter as sqlite3 instead of mysql. Why?
2) There was no 'components' folder in my project folder.
Any suggestions?

Stan

Posted by Stan on Feb 03, 2008 at 11:55 AM UTC - 5 hrs

Hi Stan. I don't know why the differences would be there. Did you try changing the adapter to your preferred DB (assuming mysql) and running it then?

Posted by Sammy Larbi on Feb 03, 2008 at 09:33 PM UTC - 5 hrs

Hey Sammy,
can you help on how to change the adapter, i have the same problem that database.yml has sqlite setup instead of mysql. How do I config it to mysql?
Thanks!

Posted by Ilyas on Feb 17, 2008 at 04:37 PM UTC - 5 hrs

Have a look at this thread: http://www.ruby-forum.com/topic/139710

Looks like they changed the default DB in the 2.0.2 release. You can specify MySQL in the database.yml file by hand (described in the post) or when creating the app with

rails myApp -d mysql (also described in the thread)

Hope that helps.

Posted by Sammy Larbi on Feb 17, 2008 at 06:15 PM UTC - 5 hrs

how to update gem 2.3.5version? what command i will give the command promt

Posted by Natarajan on Jun 10, 2011 at 03:30 AM UTC - 5 hrs

Natarajan,

Do this from the command line:

gem install rails -v 2.3.5

That will get you rails version 2.3.5

If it says something about rake requiring RubyGems version >= 1.3.2, you'll need to get the latest RubyGems version from http://rubyforge.org/frs/?group_id=126

Download, unzip, and run:

ruby setup.rb

Then try running `gem install rails -v 2.3.5` again

Posted by Sammy Larbi on Jun 10, 2011 at 06:25 AM UTC - 5 hrs

Leave a comment

Leave this field empty
Your Name
Email (not displayed, more info?)
Website

Comment:

Subcribe to this comment thread
Remember my details
Google
Web CodeOdor.com

Me
Picture of me

Topics
.NET (19)
AI/Machine Learning (14)
Answers To 100 Interview Questions (10)
Bioinformatics (2)
Business (1)
C and Cplusplus (6)
cfrails (22)
ColdFusion (78)
Customer Relations (15)
Databases (3)
DRY (18)
DSLs (11)
Future Tech (5)
Games (5)
Groovy/Grails (8)
Hardware (1)
IDEs (9)
Java (38)
JavaScript (4)
Linux (2)
Lisp (1)
Mac OS (4)
Management (15)
MediaServerX (1)
Miscellany (76)
OOAD (37)
Productivity (11)
Programming (168)
Programming Quotables (9)
Rails (31)
Ruby (67)
Save Your Job (58)
scriptaGulous (4)
Software Development Process (23)
TDD (41)
TDDing xorblog (6)
Tools (5)
Web Development (8)
Windows (1)
With (1)
YAGNI (10)

Resources
Agile Manifesto & Principles
Principles Of OOD
ColdFusion
CFUnit
Ruby
Ruby on Rails
JUnit



RSS 2.0: Full Post | Short Blurb
Subscribe by email:

Delivered by FeedBurner