Now that i have installed Aptana studio for Rails Development, I started following the tutorials from the following link.
Ubuntu comes with in built MySql installation. So i could directly start out with MYSQL development on Ubuntu. To check if MySQL is installed in your system or not, open a command terminal and type in mysql. You will get an access denied message if mySQL is installed.
Now, use the following command to start mysql.
mysql -u root -p
You will be prompted for root password, The password you should enter is 'root' without quotes.
Then you should be logged into the mysql prompt where you can try all mysql commands.
MySQL Configuration In Rails Project:-
1) You have to mention the mysql database details in the database.yml file in <rails-project-name>/config/ directoy. Make sure that the following contents are there in the database.yml file
# SQLite version 3.x
# gem install sqlite3
You might have make corresponding changes for test and production block in the database.yml file.
For more information on this, have a look at the link which i have mentioned above.
Now, we have to create this database in our mysql system. So run the following command
in the terminal
Now create the required controllers, models, views etc using the following command
rails generate scaffold recipes title:string instructions:text
where recipes is the model/controller/view i intended to create.
Now run the rake db:migrate command to create the actual tables 'recipes' in the mysql database.
Now, you are ready to view the recipes pages of our website. All code required for viewing the recipes, adding/editing and deleting the recipes are adding auotmatically by the rails scaffold generator.
You should be able to view the recipes in the dev machine in following link
To set the recipes page as the default page of our website, we can edit the config/routes.rb file
and modify the line root :to => "welcome#index" as follows
root :to => "recipes#index"