'New bar' end end module SuperClient prepend SuperClientExtension end Test class Test; include SuperClient; end Test.foo => 'New foo' Test.new.bar => 'New bar' Good practice If you do monkey patches...

guides.rubyonrails.org

However, this approach will explain all queries for the given scope which may include joins or includes. Output will resemble your database's EXPLAIN style. For example, it looks...

...like this on MySQL: User.where(id: 1).includes(:articles).explain EXPLAIN for: SELECT `users`.* FROM `users`  WHERE `users`.`id` = 1 +----+-------------+-------+-------+---------------+ | id | select_type | table | type  | possible_keys | +----+-------------+-------+-------+---------------+ |  1 | SIMPLE      | users...

...their solution a little further to prevent the leak at its root. When you include the attached module in your ApplicationController, you can just use #prepend_view_path as before...

...versions (maybe more): Rails 4.0 - 7.0 This issue is now fixed and the fix included in Rails...

...README. Most likely you want: to add the Ruby, Rails and RSpec cops to include the unit test 2. Report all existing offenses and exclude them initially

...auto-gen-config to create a file that excludes all current violations. Your tests (including the Rubocop spec) should now all be green. Commit theses changes and consider whether you...

...application must do one thing by itself: When sending HTML e-mails, you should include a plain-text body or tools like SpamAssassin will apply a significant score penalty. Here...

chris.beams.io

...body with a blank line Limit the subject line to 50 characters (max. 72), include reference (unique story ID) to requirements tracker (Linear in our case) Capitalize the subject line...

guides.rubyonrails.org

When you're localizing a Rails application, sometimes there is this urge to include a little HTML. Be it some localized link, or a set of tags, you'd...

...like to have it included in the locale file. Example: # Locale file en: page: text: 'Please visit our corporate website to learn more about the corporation .' # HAML = t('.text')

makandra dev
api.rubyonrails.org

Rails includes a way to see what an e-mail will look like. Integration to RSpec All you need to do is implement a preview-class in spec/mailers/previews/notifier_preview.rb: class NotifierPreview...

...flag trait from the card above, you can drop the does_flag trait the includes in all your models Note that the following code from the does_flag trait is...

...using a callback. before_initialize :set_newsletter private def set_newsletter return unless [nil, ''].include?(receive_newsletter) self.receive_newsletter = (user.role == 'customer') end Note: When using active_type, the attribute method...

...path with e.g. url_for (excluding :host and similar). Note that it does not include query parameters. Use params.to_unsafe_h returns a HashWithIndifferentAccess with everything from params. If none...

...with many built-in functions to manipulate color. Some of the more interesting functions include: adjust-hue($color, $degrees) Changes the hue of a color. lighten($color, $amount)

...of the project? Do you have to correct further estimates accordingly? Our estimates always include a percentage markup for organization and project management anywhere between 10% and 30%.

...must only differ in their conditions (#where, #having). If either side has a #join, #includes, etc., it will throw an error: authorized_users.and(filtered_users.join(:account)).to_sql # => ArgumentError: Relation passed to...

@cards = Card .where(...) .preload(:user, :deck) .to_a end end You can include strict_loading somewhere in the scope chain: class CardsController < ApplicationController def index @cards = Card

When changing the glibc version, it's possible that the upgrade also includes changes to how locales work. This is especially relevant when using PostgreSQL databases (of any version), since...

...Ubuntu LTS version 20.04 ships with 2.31. Upgrading operating systems between those versions will include this change in locales. If there has not been any upgrade to the OS hosting...

...access to some path methods generated by your routes. Even though you could technically include Rails.application.routes.url_helpers, this may include way too many methods and even overwrite some class methods...

...took from the start until the file transfer was just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved...

...time_redirect The time, in seconds, it took for all redirection steps including name lookup, connect, pretransfer and transfer before the final transaction was started. time_redirect shows the complete...

...an escape sequence like this: echo -en "\033]0;Hello\a" You can easily include the current path: echo -en "\033]0;$(pwd)\a" Or, to replace your home directory...

...Product owner (PO): with the customer Developer Development Take responsibility for their stories. This includes always gathering all necessary information from the project lead or the PM, communicate blockers, make...

...engineering with the customer Create stories with the project lead Communicate with the customer, including tunneling questions of developers (or have them talk to the customer directly, if required)

...new gem named memoized. memoized is API-compatible to memoizer, you just need to include Memoized instead of Memoizer: class A include Memoized memoize def hello 'hello!' end

...the file structure on disc. A general approach Part A: Create a commit which includes a script that allows you to copy the existing file to the new file structure...

Undoing a broken text is very hard or impossible. The text can include any type of file link (e.g. link to profile image) and not only image links...

github.com

ruby-warning adds custom processing for warnings, including the ability to ignore specific warning messages, ignore warnings in specific files/directories, include backtraces with warnings, treat warnings as errors, deduplicate warnings...

makandra dev
unpoly.com

...release, shipping many features and quality-of-life improvements requested by the community. Highlights include a complete overhaul of history handling, form state switching and the preservation of [up-keep...

...during rendering. ⚠️ These events are now emitted when the URL changes for any reason, including: When a script calls history.pushState() or up.history.push(). When a script calls history.replaceState() or up.history.replace().

...necessary, because you now load those libraries through esbuild. adapt your app/assets/config/manifest.js file to include only the folders that sprockets needs to take care of, e.g.: //= link_tree ../builds/