Upgrading Splurty: Part-One

I thought Splurty first needed a way someone could view all the quotes inside the database.

I decided to create a new page called “show_all”. The command rake routes did not have a path for this. I had to do it myself. I went ahead and added the code get ‘show_all’, to: ‘quotes#show_all’ to the routes.rb file.

routes.rb file

This would create a brand new route. Now lets check the routes by typing this command into the command line

rake routes
show_all GET /quotes(.:format) quotes#show_all

The next step is to add a method to the controller that stores all the quotes into a variable.

The above code should be added to the quotes_controller. The next step is to create a view and then connecting pages. Create a file called show_all.html.erb within views/quotes and add some random gibberish to it just to tell if its working.

Don’t forget to add a link into your nav bar so you can access the page.

After that, you want to take the @quotes variable that you made earlier and break it down like this…

Ah, the beauty of embedded ruby. I love it!

The next step is to add a div in the form of a Booyah box!

Let’s finally add the code that will actually be seen.

Don’t forget to style your booyah box! This is how I did mine but I encourage you to do something different.

Their can be a little code added to make it look better, but I willleave that to you. That concludes the first part of Splurty Upgrades!