I am new to programming and going through Hartl's Ruby on Rails tutorial and stuck on section 2.3.1.
I am required to create a new scaffold for the Micropost resource and to migrate the new data model into the database.
I have successfully created a new scaffold using:
$ rails generate scaffold Micropost content:string user_id:integer
and in return, I see:
$ rails generate scaffold Micropost content:string user_id:integer
invoke active_record
create db/migrate/20130711181712_create_microposts.rb
create app/models/micropost.rb
invoke test_unit
create test/unit/micropost_test.rb
create test/fixtures/microposts.yml
invoke resource_route
route resources :microposts
invoke scaffold_controller
create app/controllers/microposts_controller.rb
invoke erb
create app/views/microposts
create app/views/microposts/index.html.erb
create app/views/microposts/edit.html.erb
create app/views/microposts/show.html.erb
create app/views/microposts/new.html.erb
create app/views/microposts/_form.html.erb
invoke test_unit
create test/functional/microposts_controller_test.rb
invoke helper
create app/helpers/microposts_helper.rb
invoke test_unit
create test/unit/helpers/microposts_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/microposts.js.coffee
invoke scss
create app/assets/stylesheets/microposts.css.scss
invoke scss
identical app/assets/stylesheets/scaffolds.css.scss
As I move onto the next step for migration, I enter:
$ bundle exec rake db:migrate
and see that migration was successful:
== CreateUsers: migrating ====================================================
-- create_table(:users)
-> 0.0020s
== CreateUsers: migrated (0.0020s) ===========================================
== CreateMicroposts: migrating ===============================================
-- create_table(:microposts)
-> 0.0030s
== CreateMicroposts: migrated (0.0030s) ======================================
I run a local host and see that all micropost views are appearing fine and can create, update, and delete microposts.
Now the problem is in the next step where I am required to make changes to the folder "app/models/micropost.rb" to use length validation. However, I do not see the "micropost.rb" file listed in the models folder. I only see my ".gitkeep" and "user.rb" file from the previous exercise.
This makes me believe that migration was not successful, despite being told so and I am not sure what to do. Please help.