On Github benstevenson / meetup-february-2013-4-1
Ben / @bennett_stevens
Rails 4.1 is still in Beta, and some issues(brought up later) will be present.
Seems small but very powerful addition to the framework for API centric shops.
before_action do
request.variant = :phone if request.user_agent =~ /Nexus 5/
request.variant = :tablet if request.user_agent =~ /Nexus 7/
end
before_action is alias for before_filter
app/views/postings/show.html.erb
app/views/postings/show.html+tablet.erb
app/views/postings/show.html+phone.erb
class PostingsController < ApplicationController
def show
@posting = Posting.find(params[:id])
respond_to do |format|
format.json
format.html do |html|
html.tablet
html.phone
html.none
end
end
end
end
Replacement for Mailcatcher, Mailtrap, and Letter Opener in development.
('test' || 'spec')/mailers/previews/registration_mailer
class RegistrationMailer < ActionMailer::Preview
def new_user
RegistrationMailer.registration(User.last)
end
end
Become available at:
http://localhost:3000/rails/mailers/registraiton_mailer/new_user
Full list at:
http://localhost:3000/rails/mailers