https://www.flickr.com/photos/68103485@N05/
Examples like: <br />

https://www.flickr.com/photos/68103485@N05/
Examples like: <br />

Looks well-written, but probably not needed in a Rails project, which already has ActiveSupport for dealing with duration and periods
Utopia is a website generation framework which provides a robust set of tools to build highly complex dynamic websites. It uses the filesystem heavily for content and provides functions for interacting with files and directories as structure representing the website.
drip engine for managing, creating, and performing scheduled messages sequences
Looks really nice. May switch to this from Memoist. This alt is much more configurable.
mount IndexController do # all methods will be mounted automatically, it's just an example of refinement get '/hello', :hello_world end
.time {|timer = Timer.new.start| ... } ⇒ Object Takes a block and returns the total time it took to execute.
Dilemma: Do I use this unofficial library with its really nice idiomatic API or the official library (https://github.com/mailgun/mailgun-ruby) with its inferior API?
I wish this one was still/better maintained because I'd much rather use this API, like:
@mailgun.lists.create "devs@your.mailgun.domain"
@mailgun.lists.list
@mailgun.lists.find "devs@your.mailgun.domain"
but it's not maintained, and looks like it doesn't have the word events in the source at all, so it's missing any way to use the Events API. :(
Until now, we had a lot of code. Although we were using a plugin to help with boilerplate code, ready endpoints, and webpages for sign in/sign up management, a lot of adaptations were necessary. This is when Doorkeeper comes to the rescue. It is not only an OAuth 2 provider for Rails but also a full OAuth 2 suite for Ruby and related frameworks (Sinatra, Devise, MongoDB, support for JWT, and more).
Note that one extra type that is accepted by convention is the Boolean type, which represents both the TrueClass and FalseClass types.
Create a new controller to override the original: app/controllers/active_storage/blobs_controller.rb
Original comment:
I've never seen monkey patching done quite like this.
Usually you can't just "override" a class. You can only reopen it. You can't change its superclass. (If you needed to, you'd have to remove the old constant first.)
Rails has already defined ActiveStorage::BlobsController!
I believe the only reason this works:
class ActiveStorage::BlobsController < ActiveStorage::BaseController
is because it's reopening the existing class. We don't even need to specify the < Base class. (We can't change it, in any case.)
They do the same thing here: - https://github.com/ackama/rails-template/pull/284/files#diff-2688f6f31a499b82cb87617d6643a0a5277dc14f35f15535fd27ef80a68da520
Correction:
I guess this doesn't actually monkey patch it.
I guess it really does override the original from activestorage gem and prevent it from getting loaded.
How does it do that?
I'm guessing it's because activestorage relies on autoloading constants, and when the constant ActiveStorage::BlobsController is first encountered/referenced, autoloading looks in paths in a certain order, and finds the version in the app's app/controllers/active_storage/blobs_controller.rb before it ever gets a chance to look in the gem's paths for that same path/file.
If instead of using autoloading, it had used require_relative (or even require?? but that might have still found the app-defined version earlier in the load path), then it would have loaded the model from activestorage first, and then (possibly) loaded the model from our app, which (probably) would have reopened it, as I originally commented.
Compared to https://github.com/aki77/activestorage-validator, I slightly prefer this because
- it has more users and has been battle tested more
- is more flexible: can specify exclude as well as allow
- has more expansive Readme documentation
- is mentioned by https://github.com/thoughtbot/paperclip/blob/master/MIGRATING.md#migrating-from-paperclip-to-activestorage
- mentions security: whether or not it's needed, at least this makes extra attempt to be secure by using external tool to check content_type; https://github.com/aki77/activestorage-validator/blob/master/lib/activestorage/validator/blob.rb just uses blob.content_type, which I guess just trusts whatever ActiveStorage gives us (which seems fair too: perhaps this should be kicked up to them to be their concern)
In fact, it looks like ActiveStorage does do some kind of mime type checking...
activestorage-6.1.6/app/models/active_storage/blob/identifiable.rb
```
def identify_without_saving
unless identified?
self.content_type = identify_content_type
self.identified = true
end
end
def identify_content_type
Marcel::MimeType.for download_identifiable_chunk, name: filename.to_s, declared_type: content_type
end
```
mainstream way: ActiveRecord
biggs is a small ruby gem/rails plugin for formatting postal addresses from over 60 countries.
I think that it's nonsense not to have a method that just gives -1 or +1. Even BASIC has such a function SGN(n). Why should we have to deal with Strings when it's numbers we want to work with. But's that's just MHO.
Note: as for setting boolean variables: not only are true/false and 0/1 acceptable values, but also T/F and on/off. Thanks, coercible!
Or if you're looking for a core extension that adds this to the Array class, I'd recommend the facets gem (require 'facets/array/average'). Then you can just do array.average. And, from looking at the source, it turns out they do the exact same thing as the instance_eval approach above. The only difference is that it's implemented as a method—which of course already has self pointing to itself—instead of a block): def average; return nil if empty?; reduce(:+) / length.to_f; end Main advantage of this is that it's even more concise/readable and it handles the empty? case.
In fact, I'm only here because it seems like something one would 'expect' ruby already to do.
Trailblazer is an architectural pattern that comes with Ruby libraries to implement that pattern.
minitest doesn't reinvent anything that ruby already provides, like: classes, modules, inheritance, methods. This means you only have to learn ruby to use minitest and all of your regular OO practices like extract-method refactorings still apply.
This looks good but https://github.com/jonahb/akismet looks better maintained
If you like the straight forward and effective nature of Strong Parameters