Views are the part of the app that users see. To make one, go to this path: /app/views. You will see a folder called layouts. This contains your templates. If you made a model, then you should see a folder named after it. To use the views, make 2 files: index.html.erb and show.html.erb. Erb stands for Embedded Ruby. To use embeded Ruby, write <% @e = Example.find(1) %>. This doesn’t print out, so you have to write this to print it out: <%= @e.title %> . THe equals sign is very important. But this feels dirty, writing this logic in erb. This should go inside a controller instead. We will discuss controllers in part 3.
Subscribe to Youtube
algebra art astronomy B-Day beach biography books botany Building chess comics computer programming cooking economics electricity food fun games geography history holidays homeschooling Latin magic math Money movies music pinewood derby pumpkins racing reading Rube Goldberg Machine science snow sports story swimming time travel toys Uncategorized vacation vacations work writing
Leave A Comment