Topics Covered: Databases, Active Record, Schema, Migrations, Seeds
You will have 2 days to complete this project. We recommend starting tonight. Our cool places app, Lekker Plekke, will allow us to keep track of and share all of the cool places we find in Cape Town. Create a new rails app called lekker_plekke inside of your ixperience
folder, and initialize a git repository.
Although this is optional, we recommend that you try to complete as much of the challenge as you can.
commenter
), the text of the comment (text
), as well as a reference to the place.has_many :comments
and a Comment belongs_to :place
. Make sure your schema reflects this association as well.likes
which is an integer to your desired model. Add a link, route, and controller method that will increment the number of likes when the link is clicked on.Let's add some styling. An easy way of making your web apps look instantly better is to use Bootstrap. Bootstrap provides you with custom CSS, Javascript, and some other fun things that you can use once installed into your app. For example, Bootstrap pre-defines CSS classes to make your HTML elements look a certain way. To make your site match, you can just add the same CSS class to your HTML. To read more, you can check out this resource.
For our purposes, we just need to install the css into our rails app. To install:
gem "twitter-bootstrap-rails"
to the list.bundle install
.rails generate bootstrap:install static
Some background on gems: you can view gems as libraries or plug-ins specifically made for rails apps. It's some functionality (ie styling, passwords) that you install to fill a specific need. Gems are super powerful, and you should definitely use them in your final project!
Voila! Play around with adding certain CSS classes to your HTML elements! You can refer to the css page of Bootstrap for reference.
P.S. This includes the bonus and extra bonus! If your app doesn't look exactly like this, don't panic. As long as the content for the index and the show pages are there, you're all set.