sudo update-grub
require 'minitest/autorun' | |
require 'pry-rescue/minitest' | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'capybara/poltergeist' | |
require 'minitest/colorize' | |
Capybara.register_driver :poltergeist do |app| |
group :development, :test do | |
gem "minitest", "> 4.0" | |
gem 'minitest-rails' | |
gem "minitest-rails-capybara" | |
gem "minitest-focus" | |
gem "minitest-colorize" | |
gem "capybara-webkit" | |
gem "launchy" | |
gem "pry-rails" | |
gem "pry-doc" |
class ApplicationController < ActionController::Base | |
... | |
#Problem: | |
#In rails 3.0.1+ it is no longer possible to do this anymore; | |
# rescue_from ActionController::RoutingError, :with => :render_not_found | |
# | |
#The ActionController::RoutingError thrown is not caught by rescue_from. | |
#The alternative is to to set a catch-all route to catch all unmatched routes and send them to a method which renders an error | |
#As in http://techoctave.com/c7/posts/36-rails-3-0-rescue-from-routing-error-solution |
Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.
Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.
As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.
Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.
class API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
class API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |
pwd | grep -oh '[^\/]*$' | pbcopy |
def after_sign_in_path_for(resource) | |
current_user_path | |
end |
The majority of the projects used Rails defaults of Coffeescript, Sass, jQuery, and ERB
Only 37% of the projects used Bootstrap. I thought this number would be higher. It feels like every MVP out there starts with bootstrap.
Only 33% used HAML. I thought this number would be higher as well. I’m not a huge fan of HAML, but it seems like it’s the default templating language for most Rails developers I’ve worked with.
Around 1/3 of the projects turned off Turbolinks. I’ve spent a little bit of time using Turbolinks and while I’m not opposed to it, there are a handful of common practices that I was used to that didn’t work with Turbolinks. I suspect this was the case for many teams and just chose to turn it off out of frustration or interest in making progress elsewhere. I’ve definitely done this in the past when I just wanted to get something out the door.