Hi
I have 6 simple and fundamental Problem in RoR migration and although I
googled it and read many article about it and research it for a week , I
didn’t understand it. please help me for these problems :
1 - When I create a model (for example “rails generate model
Football_League”) , I see in db/migration a “create_football_leagues.rb”
. I want know what is the rules of RoR for changing the name that I gave
to my migration ? ( My migration’s name was FootballLeague and ruby
cretaed “create_football_leagues.rb”)
2 - What is the rules of naming ruby for creating a class in that file ?
( Ruby created a “CreateFootballLeague” class in
“create_football_leagues.rb”)
3 - After I use rake db:migrate , although I had 3 migration, I just see
such a image in cmd : ( I attached this image )
and I didn’t any migration for another 3 migrations whereas sometimes
ago when I run a migration with rake db:migrate, all my migrations are
migrated.
4 - After I type rake db:migrate and after that Rake execute
“create_football_leagues.rb” I go to mysql and I saw a table with
“schema_migrations” name. and in that table there are some versions of
my migrations. now I want to know what is the application of such a
table ?
5 - In http://guides.rubyonrails.org I read that if we want to change
the primary key of a table from default id to our own field we must use
:primary_key option but I didn’t understand how can I use it .If someone
can give an example for this subject.
6 - What is the difference between this 2 commands : 1 - “rails generate
migration footabll” 2 - rails generate model football. I knew that
with “rails generate model football” we must some extra file in
app/model but I don’t understand function of those files.
My friend please help me to solve these fundamental problems . special
thanks .