Thursday, February 22, 2007

Ruby of Rails



Originally Posted: 2007-01-30 @ 10:46:21 pm

[disclaimer -- I am not a full blown ruby programmer. I only play one on tv.]

To install rails after you install Ruby, put in...
prompt> gem install rails --remote

This will promote the rails install process. Make sure you select yes for everything it asks.

If you decide to use Apache, then please enter the line in your httpd.conf file...

<VirtualHost *>
ServerName todo
DocumentRoot /[directory]
<Directory /[directory];
Options ExecCGI FollowSymLinks
AllowOverride all
Allow from all
Order allow,deny
</Directory>
</VirtualHost>

This will redirect Apache to the necessary Ruby guts.

This code will also serve as a beginning for MySQL database for Ruby. Refer to the Rails4ruby.pdf for more detail on this publishing for Ruby.

SQL Code:

CREATE TABLE `categories` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`category` varchar(20) NOT NULL default '',
`created_on` timestamp(14) NOT NULL,
`updated_on` timestamp(14) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `category_key` (`category`)
) TYPE=MyISAM COMMENT='List of categories';

If you see a forbidden on your Apache, then one of the following have occured...

1) The app/directory has not been created using rails. at the prompt, put...
> rails [appname]
it will populate the directory with necessary information for the creation of the ruby application.

2) the incorrect directory in the virtual hosts code has been put in the Apache httpd.conf file. Make sure that the directory is correct.

That's to my knowledge anyway... If you start fiddling with Apache's httpd.conf file without knowing what you are doing, then you are at your own costs for fixing it. It's not for toying with unless you know exactly how to fix it / or you know what you're doing.

> ruby script/generate controller [App]
- Creates a new controller. The controller determines the flow for moving around the application. Modify the code accordingly to have it respond in a specific way or react in a certain way determined by the browser input. (Hence it's called the controller).

More later....

No comments: