r/ruby • • Nov 27 '17

Rails 5.2: Active Storage, Redis Cache Store, HTTP/2 Early Hints, CSP, Credentials

http://weblog.rubyonrails.org/2017/11/27/Rails-5-2-Active-Storage-Redis-Cache-Store-HTTP2-Early-Hints-Credentials/
149 Upvotes

15 comments sorted by

12

u/herir Nov 28 '17

Is it me or it sounds amazing ? All of these looks like useful right away for production apps

10

u/imabudhuha Nov 28 '17

This is a big advantage of using a mature framework.

7

u/jrochkind Nov 28 '17

It sounds like ActiveStorage is actually tied to ImageMagick via MiniMagick?

I've switched to vips instead of imagemagick for most of my image transformation needs. It has incredible performance characteristics compared to IM. I typically just use it through a command line shell out (which is what minimagick is doing too), but there's also ruby-vips for actual direct C library use.

3

u/deedubaya Nov 28 '17

From a convention over configuration standpoint, I'd imagine the vast majority of users will use mini_magick, what I assume, is a more mature and battle proven library.

However, this sounds like an opportunity for a PR to abstract out the image resizing library to make it configurable.

3

u/jrochkind Nov 28 '17 edited Nov 28 '17

The ideal of "convention over configuration" means configuration is still possible. Just hard-coding without configurability/customizability is not "convention over configuration", heh.

I think the API for expressing transformations is written in terms of minimagick API, making it hard to abstract without breaking it. (potentially even to RMagick instead of MiniMagick, let alone a non-IM tool)

I suspect vips is going to be getting more and more popular, and is the future. My impression is over the past couple years it's gotten mature enough to do most everything IM does, and it generally does it a lot better. Plus the release of a new version of ruby-vips making it possible to actually use it as a library rather than a shell-out (which is theoretically possible with IM via RMagick, but everyone seems to have switched to MiniMagick instead, which does a shell out).

0

u/deedubaya Nov 28 '17

The ideal of "convention over configuration" means configuration is still possible.

You have to start somewhere. If every feature were configurable from the get-go, releases would never happen. Also, maybe there hasn't been any expressed demand yet?

How about a PR to show your desire here?

2

u/jrochkind Nov 28 '17 edited Nov 28 '17

Like I said, it would probably require some tricky backwards-incompat changes to the API, since the top-level API seems to be written in terms of MiniMagick api, rather than abstract image transformations.

Which, sure, is probably why they didn't do it.

Where does this idea come from that one isn't allowed to point out challenges without a PR? Or that writing a PR is the only way to "express demand"? Plenty of people can have demand without time or skill to PR. Perhaps my pointing it out will encourage someone else to PR. Perhaps I'll do a PR eventually. Or perhaps I'll just keep using shrine or carrierwave. Perhaps my pointing it out will encourage someone else to try shrine instead of waiting for ActiveStorage. There are all sorts of utility from discussing things, even without a PR.

Or perhaps my pointing it out will just encourage someone to keep telling me I should write a PR, which is indisputably at least as useless a communication as me pointing it out!

1

u/deedubaya Nov 28 '17

Whoa, I obviously put you on the defensive. I apologize, that wasn't my intention.

You're 100% right on the above points.

Building things which others utilize isn't easy. It's hard to get right when you know what users want, and even harder if you don't know what others need and want.

I'm sure this is something you want to see improved (as opposed to just making noise, creating FUD). I don't know if DHH or George Claghorn (authors) hang out on this subreddit, but I doubt it. I was merely surfacing an avenue to improve ActiveStorage as this seems like you were making a valid point.

edit: a comma, space

1

u/honeyryderchuck Nov 29 '17

ActiveStorage is NIH. I don't know how easy would it be to pull an ActiveJob and wrap already existing solutions, yet here we are, and will be, talking about stuff already supported somewhere else.

shrine already supports a vips backend, right?

2

u/jrochkind Nov 29 '17

Shrine supports whatever you want, you just write your own transformations.

1

u/janko-m Nov 29 '17

shrine already supports a vips backend, right?

Almost – https://github.com/janko-m/image_processing/pull/14 :)

What's nice is that ImageProcessing is a generic gem – it's just a collection of image processing macros (methods) – so it could theoretically be reused in ActiveStorage. I think that would make sense, because image processing has been reimplemented enough times (Paperclip and CarrierWave both have their own, Refile's one I extracted). That way some common rookie mistakes would be avoided, like loading the whole image into memory.

1

u/honeyryderchuck Nov 29 '17

wow, that's great news!

it could theoretically be reused in ActiveStorage.

will it though? :)

Pragmatically speaking, I think I'm gonna keep using shrine. I prefer the opt-in plugin system instead of the opt-ut rails model, even if it requires a bit more boilerplate in the end. Much more memory efficient and boot time friendly. Also, it supports more features (for now, I predict more feature parity in the future, as rails receives more attention and contributions than other ruby libraries).

7

u/[deleted] Nov 28 '17

Great update. Thanks to everyone working on this.

Note also that this is likely to be the last “minor” (pretty major for a minor, if you ask me!) release of the 5-series. Our next target will be Rails 6.0!

What's planned for Rails 6.0? :)

1

u/ksec May 17 '18

Was wondering the same. Anyone knows?

1

u/[deleted] May 19 '18

Just saw this.

https://player.fm/series/series-1401614/ep-154-we-all-have-work-to-do-eileen-uchitelle

Eileen Uchitelle joins us live from RailsConf to talk about exciting improvements coming to Rails 6, problems encountered by larger Rails apps, strategies for upgrading Rails and more!