To get these nice Twitter Bootstrap alerts to show up in your Rails application
Image may be NSFW.
Clik here to view.
Emit them from your Rails app like this.
SomeController
class SomeController < ApplicationController before_action :last_page def what_is_automated_testing flash[:success] = 'Success' flash[:info] = 'Info' flash[:warning] = 'Warning' flash[:danger] = 'Danger' render layout: "static_page_with_sidebar" end
Now, if you have Twitter bootstrap correctly configured, you should see this.
Image may be NSFW.
Clik here to view.
If you are wondering why you don’t see this styling with the rest of your application, it’s because Rails by default doesn’t use this hashes (success, info, warning, etc) for it’s messages. It uses ‘notice’ and others instead (though some may overlap) which is defined in the defaul scaffold.scss so beware of that.
Happy styling!
Links that help
https://agilewarrior.wordpress.com/2014/04/26/how-to-add-a-flash-message-to-your-rails-page/
http://getbootstrap.com/components/#alerts
Filed under: rails Tagged: twitter bootstrap Image may be NSFW.
Clik here to view.

Clik here to view.
