Rails 4.0 Whirlwind Tour Presentation
highgroove.com
highgroove.com
Rails-world with your changing of servers and plugins-of-the-week, never change.
In rails 2.x:
Post.find(:first) # => First record, determined by db engine
Post.find(:all) # => All records
Post.find(1) # => Find record with id 1
Post.first # => Same as find(:first)
Post.all # => Same as find(:all)
Rails 3.x Post.find(:first) # Deprecated, use #first/#all
Post.find(1) # Same as 2.x
Post.first # First record, determined by db engine
Post.all # All records or force execution of a Relation
Rails 4: Post.find(:first) # RecordNotFound, could not find record with id :first
Post.find(1) # Same as 2.x
Post.first # Ordering is enforced, use #take to simulate old #first
Post.all # Always returns ActiveRecord::Relation
Post.all.to_a # Force query to execute, avoid this!
I'm not particularly unhappy about any of the changes as they definitely make it more consistent. With the move to ARel in the 3.x releases, they definitely discouraged the use of #all to force query execution (build up a query, iterate over it, don't worry about executing it).I'm actually quite glad they fixed the db ordering gotcha present when using #first and #last. It drove me nuts when I first ran into it and it has affected almost every Rails developer I've talked to.
ActionController::Live is merely an improvement of the HTTP Streaming functionality where the server will send HTML (or other data) down to the client part way through the request. So the server can send data, but not receive it from the client.
If you want to stream data to a client, then you can keep the connection open and just never "finish" the page. If you do this you'll have to be careful with concurrency etc, hence the requirement to use Thin/Rainbows/Puma not Unicorn.
A better comparison would probably be the new HTML5 Server-Sent Events (SSE) functionality. Though I'm not too familiar with that spec yet, so I can't comment on that.
I was wondering why so few police departments were using Rails.
* on a more substantial note, the biggest migration changes seem to be requiring Ruby 1.9.3+, elimination of 2.x "find" syntax, and no more vendor/plugins.
Switching find syntax over is rather simple, though tedious.
Gemifying a plugin takes 30 minutes or less in my experience. It will take more time if you haven't done it before, and more time beyond that if you've never made a gem before.
It's going to be a great release.