Settings

Theme

Ruby on Rails 5.1

edgeguides.rubyonrails.org

140 points by alifbae 9 years ago · 34 comments

Reader

eagsalazar2 9 years ago

Yarn and Webpack integration is already changing my life (for the better). Documentation on both still sucks however. In particular the inclusion of yarn and webpack represent a significant change in development workflows that they've not really outlined yet.

  • eggie5 9 years ago

    I haven't really been following yarn or web pack. Can you give an example of how it changed your life?

    • rahilsondhi 9 years ago

      Using npm alone is like using bundler without a Gemfile.lock. If one person does `npm install` today, and a new teammate does `npm install` in a month, the new teammate will install different versions. With yarn, there is a yarn.lock to make sure everyone gets the same versions when they run `yarn install`.

      Also, yarn is way faster.

3pt14159 9 years ago

I'm still surprised they removed the formatting for db/schema.rb which I rely on quite a bit to remind myself what properties models have, whether or not their status can be set to null, and how many digits of precision my decimal columns have.

I went as far as writing my own formatter which consumes the db/schema.rb generated string and outputs another string with better formatting. The code is kinda shaky because I wrote it in a rush, but if anyone is interested I can share it with them.

  • poorman 9 years ago

    You should check out the `annotate` gem.

  • ezekg 9 years ago

    As far as I can tell, they only modified the formatting used for lining up column options[0], not all formatting for the file. I hated that formatting anyways, due to the diffs it produced. I admit that I haven't tested a migration on 5.1 yet and am just looking at the commit log so maybe I'm wrong.

    [0]: https://github.com/rails/rails/pull/25675

    • 3pt14159 9 years ago

      Imagine wanting to quickly scan which attributes are required and which ones aren't. It used to be easy, find the "null" option with your eyes then scan downwards. Plus it just looks more messy now.

      • ezekg 9 years ago

        Sure, but I still wasn't a fan of the diffs that it produced—and like poorman said, if you really need that then use the annotate gem which lets you check the model file for that info instead of digging through a giant schema file.

        • 3pt14159 9 years ago

          Not what I want. No syntax highlighting, and annoying when I don't need it. Plus I always read the migration file for the db/schema diff anyway. Also, sometimes I want one place to quickly hop around in to remind myself how one area of the codebase snaps together. I never intentionally write code that is harder to read to produce readable diffs, and I don't know why generating schema.rb should be any different.

  • dorianm 9 years ago

    I'm interested, I would use `rubocop -a` personally.

  • superplussed 9 years ago

    What formatting did they remove, the indentation?

brandoncordell 9 years ago

The new form_with is bugging me. It doesn't generate id's on inputs anymore, so you have to manually add `id: 'field_id'` so that clicking labels focuses on the input. Not having the id attribute has also broken Capybara's `fill_in 'Label text'` for me.

shawabawa3 9 years ago

jQuery no longer being a default dependency is great! been waiting for that for a while

  • RubenSandwich 9 years ago

    Poor jQuery. You truly made the web a better place, but we have moved on. My feelings towards jQuery are almost exactly how I view my childhood dog. It was good while it lasted, but I really had no idea what I was doing back then.

    • jackhack 9 years ago

      If it's any consolation, your doggie didn't mind. That's what makes them such great companions.

      edit: r/care/mind

    • eagsalazar2 9 years ago

      I may not use it anymore, but I will never stop loving jQuery.

    • tomc1985 9 years ago

      jQuery's still great if you don't want to use all these cheesy new-school JS frameworks. I have yet to find it lacking

      • savanaly 9 years ago

        The new school frameworks' purpose is pretty much entirely orthogonal to that of jQuery's, although their features do overlap, which is I think why people mistakenly say what you just said so often.

        Angular, Ember, etc. are frameworks for coding routing, components, state, etc. Barely any of this was the concern of jQuery, which the main purpose of jQuery was to provide a lingua franca for interacting with browsers that were inconsistent in their implementation of javascript.

      • RubenSandwich 9 years ago

        Well, I would argue that the main purpose of jQuery was to help cover all the strange DOM edge cases of the browsers of that time. In that case, it really isn't needed anymore as most browsers behave the same on like 90% of the things now. (It's just that people used it as if it was a Framework, not a library which caused a bunch of problems.)

        I am with you that if I'm doing something lightweight I don't use any of the new fancy JS frameworks, I just write vanilla JS.

      • tomc1985 9 years ago

        jquery + vue.js on rails is pretty sweet

        and no npm dependency BS!

  • eggie5 9 years ago

    still miss prototype js...

MichaelBurge 9 years ago

It looks like "System Test" is what they call end-to-end testing using tools like Selenium with a browser. Scripts that e.g. send POST requests to the server process and check the result seem to also be included.

The new form_with looks convenient. It was always annoying occasionally having to switch all the methods out when a form gets more complex.

I don't really use frontend Javascript stuff, but mostly because it was a pain getting it to work with Rails and doesn't provide much benefit. Maybe in another year the Webpack changes will have made it worth using.

nathan_f77 9 years ago

Wow, the yarn and webpack support is awesome! I've been using the react_on_rails gem, and I didn't like how the webpack stuff felt "tacked on", and I had to run a whole bunch of different stuff using guard. Hopefully they can work with these changes and let me get back to a single "rails server" command.

"System tests" look great, too. It's great that they've brought this in as a convention, since every Rails project I've worked on has configured capybara for integration tests.

pqdbr 9 years ago

I love Rails :)

swrobel 9 years ago

This was released on April 27. Old news.

  • petercooper 9 years ago

    You're right, but curiously every post announcing Rails 5.1 at the time got nowhere on HN: https://hn.algolia.com/?query=rails%205.1&sort=byPopularity&...

    I think there's now too much going on and too few people reading /newest for the HN front page to be a resaonably accurate representation of the big stories if a key Rails release didn't even make it at the time :) Seen quite a few similar instances as well. (The real issue IMHO is not enough exposure of or encouragement to visit /newest, so it's pot luck if links get seen.)

    • tropshop 9 years ago

      Or more people are just moving on from Rails. I used to religiously follow every release. That ended shortly have the first few 3.x releases

      • petercooper 9 years ago

        There is also that. But as a very keen purveyor of /newest (I basically have every single thing come into a Slack channel) I am increasingly finding gems or even significant news that would have once done well on the front page just never reaching it. There is truly more cool stuff than we have room to show :-) That is a great opportunity as well, though.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection