11 ms·
Rails 4.2.0 beta1: Active Job, Deliver Later, Adequate Record, Web Console
- bdcravens 12y agoNice to see some of the features from better_errors make it in - I always figured it'd just replace the standard exception page.
- aaronbrethorst 12y agoSupport for real foreign keys! addforeignkey/removeforeignkey are now available in migrations. Awesome! Despite the naysayers, I still feel incredibly productive in Rails, and am so happy it continues to improve.
- mberning 12y agoAgreed. Having recently worked on an implementation using nodejs/express/angular going back to plain old Ruby/Rails is very nice.
- monsterix 12y agoTotally! And I sorely miss cool and helpful guys like Ryan Bates in the scene lately.
- eriktrautman 12y agoChris Oliver's running some good-looking screencasts to fill those shoes: https://gorails.com/ https://gorails.com/
- monsterix 12y agoThanks! Great to hear someone's taken up the good work.
- anonova 12y agoThis is great, and it looks like it was modeled after the foreigner gem (https://github.com/matthuhiggins/foreigner https://github.com/matthuhiggins/foreigner).
- walski 12y agoTotally agree, still funny how long foreign keys have been absent from vanilla Rails ;) But I guess their lack just didn't cause enough pain for someone to add them (at least it didn't for me)
- jbverschoor 12y agoRails lover here, but the original argument against used to be "you don't need foreign keys"
- tvon 12y agoSo GlobalID means instead of doing `SomeJob.enqueue(instance.id)` (and then `Model.find(id)` in the job) you just do `SomeJob.enqueue(instance)`, and presumably reference something like `object` in the job?
- mbs348 12y agoYes, exactly. It is an interesting/cool idea to create an object URI to make this possible!
- joevandyk 12y agoYou do GlobalID.locate(gid) in the job.
- DouweM 12y agoThat's incorrect. The global ID sent along the wire is transparently looked up at deserialization. See the example here: https://github.com/rails/rails/tree/master/activejob#globalid-support https://github.com/rails/rails/tree/master/activejob#globali...
- swanson 12y agoYes - there is a good example on the ActiveJob README (https://github.com/rails/activejob#globalid-support https://github.com/rails/activejob#globalid-support).
- sync 12y agoWe frequently ran into the issue of the object having been deleted while sitting in the job queue, so Model.find(id) would blow up. I'd be curious to hear if GlobalID did anything about that.
- damncabbage 12y agoThis won't do anything for you there; it just collapses a Class and a record ID down into a string for you (and then pulls it back out of your database later with a GlobalID::Locator.locate(string) call). It's not full-record-serialization, and it can't bring back deleted records for you. (See https://github.com/rails/rails/tree/master/activejob#globalid-support https://github.com/rails/rails/tree/master/activejob#globali... for an example.)
- r-s 12y agoRails gets a bit of negative press these days, but its nice to see the framework moving forward. Rails is still a great choice for a large percent of web apps. There is a fairly big community even in smaller cities, a very complete framework, a large ecosystem of gems, open source and still improving.
- liamzebedee 12y agoYes it is nice to see continued progress! Could someone explain to me what this negative press is about? I understand that Rails and Ruby by default are not as performant as Node/Go/the JVM but it supposedly functions quite well for relatively large websites (~10K users).
- shadowmint 12y agoI think you mean 'relatively small websites (~10k)' ...but yes; thats the main complaint of any substance.
- enraged_camel 12y agoWhich is confusing. I thought some huge websites (Twitter and Hulu come to mind) use Rails?
- shadowmint 12y agoTwitter is particularly notorious for once being an extremely heavy user of rails, then in ~2010 for abandoning ruby for the JVM and reporting the result was substantially faster. ...this is all ancient history now though. Come on, 2 seconds on google will find all the arguments and counter arguments about this stuff.
- vidarh 12y agoTwitter is also particularly notorious for blaming Rails when it is/was blatantly obvious their architecture at the time was a total mess. Including using Rails for stuff that should have been factored out into a separate shared-nothing backend service regardless of the frontend language/framework. They could have rewritten in pretty much anything and made it faster/more reliable.
- shouldbeworking 12y agowill there be a 420 celebration when it comes out?
- Eleopteryx 12y agoWell I'm glad someone beat me to making this kind of comment.
- andyl 12y agoOne of the things I like best is the pre-announcement that Rails 5 will be built for Ruby 2.2. I appreciate the role that DHH and Rails play in keeping the community moving forward.
- joevandyk 12y agoYes, this should clean up a ton of the code in rails. Can take use of exception causes and all the other things.
- boie0025 12y agoI'm excited for the ActiveJob abstraction layer. This means I can start building things out for background work before even deciding what I want to have handle them.
- j-kidd 12y agoI feel rather underwhelmed by the performance improvement touted by adequate records. Perhaps someone from the rails community can do something like this: http://techspot.zzzeek.org/2010/12/12/a-tale-of-three-profiles/ http://techspot.zzzeek.org/2010/12/12/a-tale-of-three-profil...
- mmanfrin 12y ago100% speedup is underwhelming?
- jrochkind1 12y ago100% speedup to certain queries, not all queries. How many queries it covers will depend on the app; as well, of course, how much of app wall time is taken up on queries. I too am curious how noticeable an improvement this will be in most apps. Is it a micro-optimization that won't be noticed much, or is it actually going to make a difference for real apps?
- jrochkind1 12y ago(And the queries that are speeded up by this optimization are probably the _fastest_ queries in your app to begin with--simple one column lookups on one table, including probably most commonly lookups by pk. I am definitely not assuming this will make any measurable performance difference to real world apps. Although it may. I don't know if anyone knows yet.)
- j-kidd 12y agoAlso from http://stackoverflow.com/a/16553503 http://stackoverflow.com/a/16553503 by the author of SQLAlchemy: > Do you have any estimates on how much time is wasted, compared to the rest of the application? Profiling here is extremely important before making your program more complex. As I will often note, Reddit serves well over one billion page views a day, they use the SQLAlchemy Core to query their database, and the last time I looked at their code they make no attempt to optimize this process - they build expression trees on the fly and compile each time.
- jiggy2011 12y ago"Adequate Record" does not exactly fill one with confidence regarding rails. This says "our last versions had inadequate performance,this one is just ok"
- chancancode 12y agoSorry you felt that way. That project was sponsored by http://adequatehq.com/ http://adequatehq.com/, so we don't really have much controll over that. Try emailing their marketing department maybe?
- jiggy2011 12y agoOh, this reminds me of that Bill Hicks clip.
- mmanfrin 12y agoIt's kind of silly to judge new features on their name, no? Adequate Record caches lookup strings, which increases AR performance considerably.
- ikawe 12y agoIt's all tongue in cheek from tenderlove, someone with a long history of contributing to ruby and rails. What is AdequateRecord Pro™? AdequateRecord Pro™ is a fork of ActiveRecord with some performance enhancements. In this post, I want to talk about how we achieved high performance in this branch. I hope you find these speed improvements to be “adequate”. Group discounts for AdequateRecord Pro™ are available depending on the number of seats you wish to purchase. -- http://tenderlovemaking.com/2014/02/19/adequaterecord-pro-like-activerecord.html
- netghost 12y agoIf you watch the closing keynote to RailsConf 2014, Tenderlove talked about that. It boils down to: 1. It's a joke. 2. Enough with hyperbole. He could have called it TurboRecord, but everything has to be "X on STEROIDS!!!!" these days, so "AdequateRecord" instead.
- ffn 12y agoOh God yes, at last, 4.2. Real foreign keys, active jobs, deliver_later, etc. I guess it's true, Overlord DHH really does hear our prayers.
- andyl 12y agoJust saw this in the release notes: The PostgreSQL adapter now supports the JSONB datatype in PostgreSQL 9.4+. Indexable/queryable JSON - so fantastic.
- chancancode 12y agoAlong with that, one of the hidden gems is that dirty tracking now detect inline changes correctly. This means things like JSON/JSONB columns Just Works™ out of the box.
- jrochkind1 12y agoNice! I've been interested in real ActiveRecord support for Postgres hstore, in a way that can do partial updates -- if only one key/value has changed, on save an update would be sent to postgres for only that key/value. This matters for concurrency issues where multiple clients may be accessing postgres and modifying the same values. Does anyone know if anyone has been working on that at all?
- rudimk 12y agoWhat's the difference between the Web Console in this release, and the IRB console that comes with Better Errors?
- mmanfrin 12y agoFor one, web console is built in. Other than that, I imagine not much.
- rudimk 12y agoI see. Should check it out, then.
- piratebroadcast 12y agoI had issues with better_errors where, if I would make a dumb-ass syntax mistake somewhere, better_errors would send me up to the superclass of the error stack, whereas the regular error page made it easier to decipher exactly what the mistake was.
- urs2102 12y ago<%= console %> is a godsend
- andyl 12y agoI was able to run bash and vim inside the browser console. And Tmux. And I could run vim inside of Tmux. Split windows, multi-tabs, htop. Guard, rspec, pry-debugger. Everything worked. WOW
- j4pe 12y agoI've been working on a Django project for the last few months. In past gigs I've used Drupal, and even talked community with one of Drupal's corporate overlords at Acquia. I enjoy working with Ember and follow its releases. But I've never grinned and cheered for new features the way I do with Rails. It took me a long time to realize that Rails' greatness isn't due to magical omakase magic - it's the community DHH (and the core team) have built over the years, and the strong product focus they've applied. Really impressive. Did Torvalds work like this? Has anyone has studied or written about organizational behavior in the open-source community?
- neya 12y agoThere was a time when I used to advocate my fellow folks here at HN (and possibly even reddit) to go for a framework built on faster languages like GoLang or Scala or even using platforms like Node.js and avoid slower ones like Rails. Now, it's time for me to apologize to the community for giving you wrong advice [1]. Turns out I could never have been more wrong. I wish I could write a long post describing each of the WHY's, but I'll be more succinct, this time: 1)If you can throw money at something at something and scale, then you're as good as gold. Rails allows you to do this. Oh, and supportive statements from Pinterest guys on the same topic - [2]. 2) The speed of a language has nothing to do with the success of your business. NOTHING. You can go with the world's slowest language and still be successful. Best example of this is Basecamp itself. As a matter of fact, even many of the popular sites (heck, even popular porn sites) still run on PHP (PHP was one of the slowest from the frameworks speed comparison conducted by Techempower - [3]). 3) The actual thing you want to be able to do is quickly iterate on your product and constantly have it evolve. This is only possible if you have a complete framework that doesn't force you to re-invent the wheel. For example, when I wrote a framework by myself in GoLang, Scala, I found myself focusing too much on basic stuff like authentication, instead of focusing on the features that are needed for the actual product. 4) (P.S this is my personal opinion) I've tried all major frameworks out there and I've come back to Rails again. Why? Because its philosophy resonates with me (yes, now it does). For me, the three most important elements for a successful product are - Speed, Reliability, Consistency. Rails provides me with all these three. (And please try Puma, it's pretty impressive!). As for me, the ability to seamlessly integrate SASS, Compass and HAML (which help me divide my product development time multiple folds) makes Rails a clear winner for me. And now Active Job, Deliver Later, Adequate Record, Web Console now make Rails much more complete than ever. (Thank you DHH!) In the last 6 months, I've written 4 complete products for 4 different people (one of them, being mine) that is well tested and works perfectly as intended. Compare this to something like last year where I spent 2-3 months writing just a single software product (for myself) while I was trying to use GoLang (<- or insert another faster language here) (because I also had to take care of all the other things like Authentication, etc). The point is, ultimately you want to run a successful business. And if you're worried if the slowness of your language will hinder it's growth, then nope. That will not happen. I hope this helps someone. Cheers. [1] https://news.ycombinator.com/threads?id=neya&next=6993616 https://news.ycombinator.com/threads?id=neya&next=6993616 [2] http://highscalability.com/blog/2013/4/15/scaling-pinterest-from-0-to-10s-of-billions-of-page-views-a.html http://highscalability.com/blog/2013/4/15/scaling-pinterest-... [3] http://www.techempower.com/benchmarks/#section=data-r8&hw=i7&test=json http://www.techempower.com/benchmarks/#section=data-r8&hw=i7...
- _mikz 12y agoI'm quite surprised by removing `respond_with` to a gem.
- mrinterweb 12y agoI'm pretty sure that 90% of my controller actions use respond_with. I don't understand the desire to remove that from the rails core.
- VeejayRampay 12y agoA big thank you to all the contributors who keep making Rails better and more polished at each release. Rails 4.x is great.
- oliyoung 12y agoI love Rails, it's been my tool of choice for the last six years, but "Support for real foreign keys!" shouldn't be a thing in a change-log in 2014.
- sleepyhead 12y agoSo you don't want support for real foreign keys?
- anonova 12y agoHe probably means that foreign key support should have been added in a far earlier version of Rails.
- martijn_himself 12y agoSorry to 'hijack' the thread but I was wondering, as a newcomer to Ruby and Rails, what would be the best way to learn it? (without spending too much money). It seems to me because it is such a mature framework there are a lot of Rails-specific techniques and components to learn, this seems quite daunting to me, am I correct?
- dankohn1 12y agoThe Hartl book is considered one of the best introductions, and covers all the major Rails features and conventions. It's free to read online, and there is also great support for it via Stack Overflow. http://www.railstutorial.org/book http://www.railstutorial.org/book
- piratebroadcast 12y ago+1 start here
- mhartl 12y agoThanks for the plug. Be sure to watch for an upcoming announcement, too: http://news.railstutorial.org/ http://news.railstutorial.org/ The upcoming third edition, which I hope to start publishing soon in draft form, is by far the most newbie-friendly edition yet. Indeed, it threads a rare needle: it's both easier and it covers more advanced material than previous editions. (This includes a rewritten chapter on login & authentication, an all-new section on image upload, and an all-new chapter on account activation and password resets.)
- brandonmenc 12y agoAfter reading the official guides (http://guides.rubyonrails.org http://guides.rubyonrails.org) the next place to go is Railscasts (http://railscasts.com http://railscasts.com). Make sure you only watch the episodes for Rails version 3.2 and greater. Each episode is linked to a github project featuring complete Rails apps - read and modify those apps.
- josephlord 12y ago
- resca79 12y agoHere a rails committer. Rails is 10 years old and it has definitely changed the web development. But the unnecessary controversy always seem the same of its first year. While in the last 10 years, many people talking Rails does not scale and ruby is slow, for many companies rails was and is a great "tool" to delivery great web apps. Thanks Rails
- axx 12y agoYou don't need to make everything scalable right from the start. If your business is profitable you should have enough money to think about scaling later. To me, the possibility to iterate fast has a much higher priority than thinking about scaling if i have a few or not that many customers. Thinking about performance problems when you start your first project/startup is like thinking about what to buy IF you win the lottery.
- cpursley 12y agoTruly impressive. I'd also like to see the Rails team focus on Rails-as-API for those of us who have moved on from the asset pipeline (splitting the server side from client side). It would be nice to have a "API only" flag option when generating a new rails project. Something like: `rails new myapp -api`. This could keep Rails going for another 10 years. I'm looking into using Napa, a Grape based API framework, for the purpose of Ruby server-side API apps: https://github.com/bellycard/napa https://github.com/bellycard/napa (Napa is to Grape as Padrino is to Sinatra) Related reading: http://www.divshot.com/blog/opinion/every-web-app-is-two-apps http://www.divshot.com/blog/opinion/every-web-app-is-two-app...
- steveklabnik 12y ago> It would be nice to have a "API only" flag option when generating a new rails project. This was rejected by core and turned into http://github.com/rails-api/ http://github.com/rails-api/ , which has had some maintenance issues, but is getting back on track. (see https://groups.google.com/d/msg/rails-api-core/8zu1xjIOTAM/1OXeQxq11ysJ https://groups.google.com/d/msg/rails-api-core/8zu1xjIOTAM/1... . This is about AMS, but that's only because updating rails-api itself should be easy, and I'm going to check it out as well)
- raitom 12y agoYou can check this : https://github.com/rails-api/rails-api https://github.com/rails-api/rails-api
- gt565k 12y agoMy biggest gripe about Rails are the model validations and DB adapters. As someone coming from Django, I hate that I have to explicitly define db related validations and catch exceptions thrown by postgres instead of it just being handled by AR with the DB adapter based on the database constraints. I love how Django handles that and I hope this finds its way into Rails one day.