looks up the autoload paths for the constant_name.underscore e.g. User.ﬁnd(id) but User was still not loaded, Rails automatically ﬁnds app/models/ user.rb and loads it So we don't have to manually write require everywhere
be loaded when require 'foo' was executed (usually performed by Bundler) When you read a plugin code, always start reading from this ﬁle You can put lib/bar.rb, lib/baz.rb or anything, but that would break other Gems. Do NEVER do that.
the gem's namespace gemdir/lib/foo/ directory is where you can physically put the code You can create any directories under your gemdir/lib/ directory, but don't create anything else Do never invade other plugins' namespace
render if object.class.ancestors.include?(ActiveModel::Validations && ... @options["required"] ||= @options[:required] || object.class.attribute_required?(@method_name) end super ennd ActionView::Helpers::Tags::TextField.prepend Html5Validators::ActionViewExtension::PresenceValidator
1 Ruby has Module#prepend as a core feature since Ruby 2.0 alias_method_chain has been deprecated in Rails 5.0 Rails 5 plugins should use Module#prepend instead Rails 5 plugins should drop Ruby 1 support