The best practice is to use a database based session, which thankfully is very easy with Rails:
Project::Application.config.session_store :active_record_store
The best practice is to use a database based session, which thankfully is very easy with Rails:
Project::Application.config.session_store :active_record_store
# examples of rails 4 routes concerns | |
concern :commentable do | |
resources :comments | |
end | |
concern :image_attachable do | |
resources :images, only: :index | |
end | |
resources :messages, concerns: :commentable |
origin: jerodsanto Blog
Since Rails 3 you’ve been able to configure an app to handle exceptions, which you want to point right at your router. To do this, add the following to config/application.rb:
guard 'rails', :host => "127.0.0.1", :port => '35728' do | |
watch('Gemfile.lock') | |
# Rails | |
watch(%r{app/controllers/.+\.(rb)$}) | |
watch(%r{app/helpers/.+\.rb}) | |
watch(%r{app/mailers/.+\.(rb)$}) | |
watch(%r{app/models/.+\.(rb)$}) | |
watch(%r{app/serializers/.+\.(rb)$}) | |
watch(%r{app/uploaders/.+\.rb}) | |
watch(%r{app/views/.+\.(erb|haml|slim)$}) |
class CatchJsonParseErrors | |
def initialize app | |
@app = app | |
end | |
def call env | |
begin | |
@app.call(env) | |
rescue ActionDispatch::ParamsParser::ParseError => exception |
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.
def after_sign_in_path_for(resource) | |
current_user_path | |
end |