3 ms·
Rails has really kept up its development pace nicely. Nested assignments and forms are a wonderful addition. Dealing with related data (in forms and saving) h
by mdasen 18y ago
Rails has really kept up its development pace nicely. Nested assignments and forms are a wonderful addition. Dealing with related data (in forms and saving) had always been quite a pain and they've done a great job of making that a lot easier.
Some things not mentioned in the slideshow that were important (at least in my opinion):
* Dynamic scopes: you can say Article.scope_by_XXX and it will allow you to use scopes without explicitly naming all of them.
* Batch processing: this allows you to get the results of a query in smaller batches so that you don't have to load everything into memory at once.
* Rack support: it's nice to have Rails being able to be deployed in the way that the community is going for Ruby apps.
* Try: probably one of the best additions. It allows you to say @person.spouse.try(:first_name). Normally, if the person didn't have a spouse and you did @person.spouse.first_name you'd get an exception saying that nil (which is what @person.spouse would evaluate to) doesn't have a method first_name - which is true. This way you don't have to keep saying, "only call @person.spouse.first_name if the @person has a spouse".
* Application Templates: These are basically shortcut files you can make for setting up a new project. We all have slight variants and we can set up the default things we want in all our applications so we aren't starting from such a blank slate (and that way you don't forget to do things like create a .gitignore file before you put your database password out there for the world to see).
- 100k 18y agoGood list of other cool things. (Rack is sort of implicitly in my presentation due to the Rails Metal thing.) I had to really narrow it down to get 10 things. I wanted to put ActiveSupport::MessageEncryptor in there for sure but I couldn't figure out anything else to take out so I had to cut it.
- gamache 18y agoOh, good to hear about try() -- that totally beats Object#andand.
- jpcx01 18y agoHmm.. not really. But its ok. andand is much cooler since you can call functions directly, and with arguments. Try is good for sending simple messages like :size and :errors and not have to care if the object is nil
- locnguyen 18y agoNested forms scratches the worst itch for me. Compared to the other changes it's nothing huge, but it sure makes day-to-day coding more developer friendly. That's what RoR is about anyway.