
Ruby on Rails 4.0.0.beta1 released - steveklabnik
http://weblog.rubyonrails.org/2013/2/25/Rails-4-0-beta1/
======
steveklabnik
Hello everyone! I am MEGA EXCITED for this release, as it's the first version
in which I'm a committer. Wooo! In addition, 954 other intrepid Rubyists in
total contributed to this release:
<http://contributors.rubyonrails.org/edge/contributors>

Please note that this is a beta, not an rc, so some things may be a bit wonky.
Please file an issue on GitHub and I will do everything I can to help you help
us iron out all the kinks.

❤❤❤

(Also, I am on a plane and my battery is almost dead, so I may drop out of
this thread soon. Ill read it when I'm home.)

~~~
grey-area
I'm curious to know if these examples of potential SQL injection tested
against 3.2.11 have been dealt with in 4.0? Would be great to see these
possible problems tidied up.

<http://rails-sqli.org/>

~~~
steveklabnik
I am not a member of the security team, but it's my understanding that all
security patches were also applied against master where appropriate.

(The security team is a subset of the core team, in accordance with least
privilege and all that.)

~~~
grey-area
OK. I've checked against 3.2.12, and at least one isn't fixed, so it might be
worth passing the link on to the security team. They'll all be easy fixes, and
it'd be great to see them fixed (if not already) in 4.0.

Thanks for contributing Rails 4.0 - I'm excited to try it out, in particular
the new caching looks great.

------
newhouseb
I'm not a rubyist but I'm really excited for the russian-doll caching and
really hope it catches on in other frameworks. Data dependency tracking makes
everything from straight-up caching to real-time updates effortless and I
think is one of the few places where an ORM can be really helpful (queue the
two hard problems quote about cache-invalidation and naming things). Quora has
been doing this since the beginning and I'm surprised it hasn't caught on in
other open source (namely python) frameworks to the same degree, hopefully RoR
will add some fuel to the fire.

~~~
riffraff
> (queue the two hard problems quote about cache-invalidation and naming
> things)

I think you meant "cue", otherwise please help a foreigner with this english
expression's meaning.. queue onto what?

~~~
newhouseb
Yep, you're correct. "Queue" is just the programmer in me typing.

------
adml
I am writing an upgrade handbook that covers the important deprecations and
new features in detail: <http://www.upgradingtorails4.com/>

------
ghiculescu
What's the recommended alternative to ActiveRecord Observers? I know they
aren't perfect, but I wasn't a fan of cluttering my models with lots of
after_commit - is there a better way?

~~~
byroot
I don't know if it's recommended but for simple cases where I just want to
trigger some methods on multiple models I just use a concern:
<https://gist.github.com/byroot/5036110>

------
5vforest
What is the "Rails way" of doing AJAX calls and updating the DOM? I've been
embedding Backbone views in the parts of my app that are the most interactive,
but I feel like there's gotta be a better way.

~~~
steveklabnik
It just so happens that one of my major contributions to this release was
writing a 'working with JavaScript in Rails' guide:
[http://edgeguides.rubyonrails.org/working_with_javascript_in...](http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html)

Others mentioned Turbolinks, but they forgot about remote_form_for and
friends.

If you _are_ building a full JavaScript application, Ember.js works really
well with Rails + ActiveModel::Serializers. There might be some rough patches
until Ember hits 1.0 final, but most of the pieces are in place.

~~~
_frog
Just want to chime in and say how fantastically ActiveModel::Serializers and
the Ember.js REST adapter work together. I built a project with them over the
weekend and the experience was overwhelmingly frictionless to a degree I
hadn't experienced doing this kind of thing in the past.

~~~
steveklabnik
Thanks. I've been kinda ignoring AMS in order to get this release out the
door, but now that it's out, expect to see much more soon...

------
jotto
does threadsafe and ruby 2.0 mean we can create multiple instances with
something like unicorn without forking the entire codebase?

~~~
atambo
Ruby 2.0 still has the GIL so if you want to run a threaded web server you'll
still need to be using rubinius or jruby.

~~~
nefasti
Any reason ruby still has the GIL and not moved to a thread implementation?

~~~
steveklabnik
Matz likes the fact that it Just Works and you can't accidentally have
weirdness based on how your code runs. There aren't any plans to remove it at
this time.

~~~
33degrees
I can imagine a whole bunch of gems suddenly breaking if this changes...

~~~
steveklabnik
That's true, but I don't buy that argument: look at how fast everyone has
updated their gems to be Ruby 2.0 compatible. The Ruby world likes running on
the edge; if MRI forced us to consider thread safety, we'd learn about the
issue much quicker as a community. Since we'd be forced to. ;)

~~~
33degrees
Oh I don't doubt that the community would move quite quickly to support it,
but it certainly wouldn't be without some bumps along the way!

------
DanielKehoe
Here's an article that shows how to set up both Rails 3.2 and 4.0 with Ruby
2.0. Uses some new features of rvm. "With both versions on your machine,
you’ll explore the new features of Rails 4.0 while continuing to develop
projects with the most recent stable version."

<http://railsapps.github.com/installing-rails.html>

------
JuDue
Sorry for the naive question... But does this help Heroku's woes?

~~~
xutopia
Nope. The issue at Heroku is before the request has a chance to talk to the
rails application. That is why so many people were annoyed that the reporting
tool that analyzes speed of the rails application did not report the time
lost.

------
davidw
Is the web socket story substantially the same? In other words, Rails just
isn't that great a platform for it?

I think Rails is great, but this is one area where it's not a good choice.

~~~
VeejayRampay
The general opinion in the Rails ecosystem seems to be that WebSockets don't
solve any real problems and that they are a toy.

The only mentions of WebSockets I've seen from people invested in Rails are
mostly made of people actually deriding them and passive-aggressively making
fun of people that use them or want to (generally in a bunch with MongoDB,
Hadoop, Cassandra or other modern big data tools that don't fall naturally in
the Rails ecosystem).

But then again, it's not like they have an infinite amount of time to invest
into everything and anything and they worked on SSE for Rails 4 on top of
shitloads of additional goodies, patched a lot of security issues so overall
I'm pretty happy as an end-user.

------
mrmagooey
Is there a Turbolinks equivalent for Django? Or something platform agnostic (I
couldn't tell if that was the case with Turbolinks)?

~~~
steveklabnik
Turbolinks is 100% Coffeescript; you could easily add it to a Django
application by copying the assets out of the gem:
[https://github.com/rails/turbolinks/blob/master/lib/assets/j...](https://github.com/rails/turbolinks/blob/master/lib/assets/javascripts/turbolinks.js.coffee)

------
egonschiele
How is live streaming implemented?

~~~
steveklabnik
[https://github.com/rails/rails/blob/master/actionpack/lib/ac...](https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/live.rb)

------
hayksaakian
How well does rails 4 play with mongoid? Any breaking changes I should be
aware of?

~~~
steveklabnik
I'm not sure, because I don't use it, but edge mongoid at least claims to be
compatible:
[https://github.com/mongoid/mongoid/blob/master/mongoid.gemsp...](https://github.com/mongoid/mongoid/blob/master/mongoid.gemspec#L22)

