TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Rails 4.1.0 released

417 点作者 chancancode大约 11 年前

15 条评论

eggbrain大约 11 年前
For those curious as to how things go from Rails 3 to Rails 4.1, I&#x27;ve now built a few Rails 4 and 4.1 apps for clients and here&#x27;s been my thoughts:<p>1) Turbolinks comes standard with Rails 4, and you will either love it or hate it. If you do use it, expect your javascript to break at one point or another. The jquery.turbolinks gem helps, but I&#x27;ve still had to debug a bunch of funky behavior with it.<p>2) Strong parameters takes a while to get used to from the old attr_accessesible way of doing things. That being said, I think it&#x27;s worth it to learn it. It prevents a lot of conditional attr_accessible :blah, :as =&gt; :admin that goes on. The one thing I&#x27;d say is if you are going to use strong parameters, you might want to install a gem like Annotate so you can keep track of your attributes in the models. Sure you can just look in Schema.rb, but tabbing back and forth gets to be kind of a pain.<p>3) Secrets.yml is great, no more worrying about adding your config.secret_token to the .env file when generating every single project.<p>4) Mail Preview is nice, but for some reason I still seem to use Mailcatcher mostly to view &#x2F; see how emails render out. Think this is mostly me sticking to my own ways.<p>5) ActionController::Live still feels pretty half baked. The fact that most examples &#x2F; tutorials on the web still use the default example of:<p><pre><code> 100.times { response.stream.write &quot;hello world\n&quot; sleep 1 } </code></pre> Seems quite telling. It feels like they&#x27;ve given some of the pieces to get live streaming working flawlessly, but we are still missing a few tools here.<p>----<p>The biggest problem I&#x27;ve had is that some gems that we used frequently would break because they weren&#x27;t Rails 4 ready. We use ActiveAdmin pretty frequently in our client apps, and it&#x27;s worked for a while, but it&#x27;s always been on a custom branch and still had some issues that were just recently fixed. YMMV for gems that your app relies on in terms of what will break and what will work.
评论 #7556071 未加载
评论 #7556041 未加载
评论 #7556010 未加载
评论 #7558630 未加载
评论 #7555959 未加载
评论 #7557005 未加载
评论 #7556405 未加载
quaunaut大约 11 年前
The Enum implementation seems full of caveats.<p>1. It saves values as integers in the database, meaning that removing properties involves explicit setting, and reordering them requires custom migration code.<p>2. &quot;Avoid using the same names inside different enums in the same class! Doing so will leave Active Record very confused!&quot;[1]<p>That&#x27;s right, we can&#x27;t use the same enum name to two different fields <i>because ActiveRecord might get confused</i>. That&#x27;s kind of poor, isn&#x27;t it?<p>3. Having to pass a macro that&#x27;ll return the right integer instead of the symbol itself? Really?<p>This all seems <i>really</i> unwieldy, especially in the face of Enumerize(<a href="https://github.com/brainspec/enumerize" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;brainspec&#x2F;enumerize</a>). It&#x27;s got none of these caveats. Is there some strength to the Rails enums that Enumerize doesn&#x27;t capitalize on, other than size constraints by using Int instead of String?<p>[1] <a href="http://brewhouse.io/blog/2013/12/17/whats-new-in-rails-4-1.html" rel="nofollow">http:&#x2F;&#x2F;brewhouse.io&#x2F;blog&#x2F;2013&#x2F;12&#x2F;17&#x2F;whats-new-in-rails-4-1.h...</a>
评论 #7556256 未加载
losvedir大约 11 年前
My company is still on Rails 3.2. We had been waiting for the first minor release of Rails 4 to give folks a chance to work out issues, so maybe now it&#x27;s time to look at upgrading.<p>Anyone have major issues going from 3.2 -&gt; 4? I&#x27;ve heard horror stories about 2 -&gt; 3, but I didn&#x27;t pick up Rails myself until 3.x so I don&#x27;t have firsthand experience.<p>The biggest change I see is attr_accessible to strong_parameters. Does that mean I need to go through and rewrite all our models and controllers before we can update?
评论 #7555903 未加载
评论 #7555612 未加载
评论 #7555640 未加载
评论 #7555661 未加载
评论 #7555807 未加载
评论 #7555624 未加载
评论 #7555608 未加载
评论 #7555646 未加载
评论 #7555619 未加载
评论 #7556054 未加载
评论 #7555737 未加载
recursive大约 11 年前
I don&#x27;t have much to say about any of the new functionality, but Spring seems like a very poor name for anything new related to programming.
评论 #7555682 未加载
评论 #7557236 未加载
评论 #7556478 未加载
callmeed大约 11 年前
Having mailer previews built in is pretty awesome. I pretty much use a gem for that on every project nowadays.<p>The variants thing is interesting ... I&#x27;m assuming its an alternative to rendering a responsive&#x2F;mobile-first view (on a view-by-view basis). I&#x27;m sure there are plenty of use-cases but I don&#x27;t like the prospect of having to update yet-another-set-of-layouts-and-views.
评论 #7555659 未加载
matthewmacleod大约 11 年前
Upgrading from 4.0 to 4.1<p><pre><code> 1013 runs, 351 assertions, 6 failures, 832 errors, 0 skips </code></pre> Ouch. Still, it&#x27;s great to see development on Rails continue. It really hits a great sweet spot for small to mid-sized apps.<p>Edit: Actually easier than I thought; about 10 minutes to figure out the cause and remove a surplus gem, and we&#x27;re all green. Cool.
评论 #7556020 未加载
评论 #7556450 未加载
simple10大约 11 年前
We&#x27;ve been using Rails 4.1 release candidates for a couple of projects. It&#x27;s worth the upgrade from 3.2.<p>Here&#x27;s a Rails 4.1.0 starter kit that&#x27;s production ready and full featured: <a href="https://github.com/starterkits/rails4-starterkit" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;starterkits&#x2F;rails4-starterkit</a>
评论 #7555972 未加载
DanielKehoe大约 11 年前
I&#x27;ve updated the ‘Learn Ruby on Rails’ book for Rails 4.1:<p><a href="http://learn-rails.com/learn-ruby-on-rails.html" rel="nofollow">http:&#x2F;&#x2F;learn-rails.com&#x2F;learn-ruby-on-rails.html</a><p>Also, there are 5 starter apps for Rails 4.1 from Rails Composer:<p><a href="http://blog.railsapps.org/post/79115273530/5-starter-apps-for-rails-4-1-from-rails-composer" rel="nofollow">http:&#x2F;&#x2F;blog.railsapps.org&#x2F;post&#x2F;79115273530&#x2F;5-starter-apps-fo...</a>
joevandyk大约 11 年前
You&#x27;d think the new enum support could use.. you know.. ENUMS. <a href="http://www.postgresql.org/docs/9.3/static/datatype-enum.html" rel="nofollow">http:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;9.3&#x2F;static&#x2F;datatype-enum.html</a>
评论 #7556895 未加载
Podeau大约 11 年前
More info on Secrets.yml VS Figaro here <a href="http://collectiveidea.com/blog/archives/2013/12/18/the-marriage-of-figaro-and-rails/" rel="nofollow">http:&#x2F;&#x2F;collectiveidea.com&#x2F;blog&#x2F;archives&#x2F;2013&#x2F;12&#x2F;18&#x2F;the-marri...</a>
desireco42大约 11 年前
The only thing I noticed, aside from secrets file and cookies etc that is outline in the notes, is that SimpleForm stopped working. Since project I was upgrading was small, I just removed it, but that is not option for bigger projects.
sergiotapia大约 11 年前
I am _stupidly_ excited for Variants. No more .hidden-xs, visible-xs markup for me. I can taste the savings! :D<p>A massive thank you to the Rails team for their time and commitment towards making the best web framework on the web even better!
karmajunkie大约 11 年前
Am I the only one who thinks the `Module.concerning` thing is silly?<p>Concerns never did anything for reducing real complexity in the first place, except improve code geography, and now we don&#x27;t even have to bother with that. Yay.
abvdasker大约 11 年前
Mailer previews will literally shave hours of time off of my email testing workflow — no more mail-to-a-test-account-and-wait garbage. And that&#x27;s one of the minor features.
评论 #7556274 未加载
评论 #7558644 未加载
评论 #7556492 未加载
评论 #7556721 未加载
NicoJuicy大约 11 年前
Is SQLLite fixed for Windows 7 or Windows 8 x64? This was the reason why i uninstalled Rails 4...