In the same '/app/views/tweets/' directory I create a very simple _partial _file that will be called whenever an individual tweet needs to be displayed.
That file is called "_erb" and the contents look like this: The contents of the '/app/views/tweets/erb' file I mentioned above look like this: And that's it!
I would like to make things as automatic as possible so I don't have to manually port any of the existing data or create the model properties. I'm going to follow the guidelines in the Rails Guides for configuring a My SQL DB.
I found this thread on that explains the basics of how to migrate an existing My SQL DB so it works with Rails. The guidelines say that I should change my config/file to look something like this: With some small tweaks to match my local environment, I'm ready for step 2: 2.
I run 'mysqladmin variables | grep socket' from the command line and find out that my socket file is located at '/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock' because, of course, I'm running XAMPP for my My SQL server. It seemingly faithfully describes the tables and fields of my DB.
Modify 001_as follows − The ID column will be created automatically, so don't do it here as well.Rake is a Ruby build program similar to Unix make program that Rails takes advantage of, to simplify the execution of complex tasks such as updating a database's structure etc.If you would like to specify what Rails environment to use for the migration, use the RAILS_ENV shell variable.Notice that you are using lower case for book and subject and plural form while creating migrations.This is a Rails paradigm that you should follow each time you create a Migration.Modify 002_as follows − The above script will be used to create subjects table and will create five records in the subjects table.