Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

understanding flash

Everything runs without throwing errors in my Odat application but I am not adding the flash type (error, success, notice) to the alert/flash div in any route. I'm not sure where to begin to look to figure out where the problem is coming from. Any help in figuring out which files you would need to see in order to know the issue would be a good starting point, but the entire codebase is on https://github.com/aquisenberry/CodeLouisvilleRuby/tree/master/CL02Tasklist_Odot if that helps

Thanks for any help ahead of time

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

OK, so go to your app/views/layouts/application.erb file and find this:

<div class="alert flash <% type %>">

it needs an additional = sign o actually put the type inside, right now it's only evaluated, not printed.

<div class="alert flash <%= type %>">

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

OK, if you want to have more flash types available (aside from notice and alert), tead this: http://mczuchnowski.github.io/quick%20tips/2015/03/27/introducing-custom-flash-types/

In your todo_lists_controller I see two places where you assign any kind of flash message: in the update and create actions, and only if they are successful. Aren't they displaying properly?

I'm sure that they are displaying the way that I am telling them to, however I do not believe I am telling them to display the way that I want them to. If you inspect the element, the div's class should bee (class="alert flash success") but instead I'm getting (class="alert flash ")