Hacker News new | past | comments | ask | show | jobs | submit login
Rails 4.0 Whirlwind Tour Presentation (highgroove.com)
155 points by vanstee on Oct 18, 2012 | hide | past | favorite | 20 comments



So as someone out of the rails world for a few years, I found the line about the webserver needing to be "thin/rainbows/puma over unicorn" hilarious, since I have no idea what any of those words mean.

Rails-world with your changing of servers and plugins-of-the-week, never change.


Thin/Unicorn/Rainbows have been around for like 3+ years.


Under the "Most Important Change" header: http://speakerdeck.com/u/alindeman/p/rails-4-dot-0-whirlwind...

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.


And of those migration changes, the move to 1.9.3 will be the biggest change for shops still on 1.8. If you're already on 1.9, the move is straightforward.

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.


Yeah, the good ol' inflector. There's actually more to it, it can use locales now and it's been cleaned up: http://davidcelis.com/blog/2012/07/31/edge-rails-a-multiling...

It's going to be a great release.


For anyone that lives near Atlanta, this was recorded at http://www.meetup.com/atlantaruby/. Our next meetup will be November 14th if you want to hear more awesome talks like this one. </shameless plug>


I've been to that meetup before, very high quality, many talented people, and interesting talks (and lot's of recruiters). They also have a Saturday RoR beginners group if anyone is interested.


Argh. I'm on an iPhone and I can't read this because they made their JavaScript just blindly redirect to their mobile site without any regard to the specific page I was on. I wish people would stop doing that, or at least provide a way to opt out of the redirect.


Might be a little late, but the "Visit Full Site" link should take you to the correct page.


Thanks! It worked great!


Of course the most used ActiveRecord method is going to be the one that changes most frequently! Let's change it every release!


You referring to the removal of deprecated methods from the 2.x branch?


I think the parent is referring to the changes to ActiveRecord::Base#find and its convenience helpers, #first, #last, and #all. I'm not sure what else it could be. It's definitely true that the semantics of the finders have changed and they're huge gotchas to newbies to Rails. Here's a brief review:

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.


Yes, but I've been using Rails long enough to remember when they removed `Post.find_first`, and there was even a time when `Post.find(:first)` was the only version - `Post.first` was added late in the 2.x series.


Wow I didn't actually know that. I started using Rails seriously around 2.3 so I always wondered why everyone was always using find(:first) instead of just first. I never even knew about #find_first!


Rails newbie here: Can someone explain how ActionController::Live compares to websockets and other similar technologies? Pros + Cons + if my comparison is even sensible?


WebSockets enables two-way communication between the server and client.

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'm really liking live streaming, opens up rails to be a simple back end for simple games.


Anyone know if Jruby is compatible already, or will I have to wait for it to catch up.


Aaron Patterson (tenderlove) had a blog post where he talked about the necessity of refactoring rack. I guess that is a larger project that isn't happening right now but that should lead to real performance improvements.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: