class: center, middle, smaller-ruby ![ruby](ruby.png) # Ruby on Rails ## 4.2 preview --- class: me-background # `whoami` * Leonard * Ruby/Rails/Web Dev * [@lgarvey](https://twitter.com/lgarvey) --- class: reinteractive, center, middle ![logo1](reinteractive-logo1.jpg) ![logo2](reinteractive-logo2.png) We build custom online applications primarily with Ruby on Rails. --- class: center gorby-background # AdequateRecord >> AdequateRecord is a set of patches that adds cache stuff to make ActiveRecord 2x faster --- class: centered-title # ActiveJob ```ruby # in an initializer ActiveJob::Base.queue_adapter = :sidekiq # :inline and other worse options # in app/jobs/publish_blog_job.rb class PublishBlogJob < ActiveJob::Base def perform(blog) blog.publish! end end # when you create your blog post. Service/Factory object. PublishBlogJob.set(wait_until: blog.publish_at).perform_later(blog) ``` * GlobalID looks handy. * ActionMailer has `#deliver_later` to async send your emails. ??? I will be interested to see how the Sidekiq community evolves from this. Personally I find Sidetiq to be amazingly useful, but seeing how this integrates in is not obvious. --- class: center, middle # Web console IRB in your browser, development exceptions have IRB too. ## `better_errors` is still better.. #### Seriously, just use [`better_errors`](https://github.com/charliesome/better_errors) ??? Better errors is still better. --- class: rails # Interesting changes * `respond_with` is now in a separate gem. * Changed default value for `config.assets.digest` to true in development * `*_filter` (like `before_filter`) no longer documented. Use `*_action` instead! * Removed `*_path` helpers from `ActionMailer` use `*_url` helpers instead. * Added `rake db:purge` to empty the current database. * Support for foreign keys. * Support for Postgres 9.4 JSONB! * No more 255 character limit for strings in Postgres and SQLite. * I added configuration to allow mail previews to be used outside of development. ??? The foreign key support is nearly identical to foreigner. Personally I dont think it is fully complete yet since there are a few helpers which should probably add a foreign key but dont. Support for JSONB is huge. There should be zero-reason to use Mongo over Postgres now.