'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...

SimpleForm comes with an option browser_validations which could be used to give fields that have a presence validation the...

...config/application.rb config.action_controller.include_all_helpers = true If you cannot use this setting, your spec can include individual helper modules like this: describe 'some view', type: :view do helper SomeHelper helper OtherHelper...

render 'view_that_uses_helpers' end end Alternatively you can also explicitly include all helpers of a given controller like this: describe 'some view', type: :view do

...excludes spaces, control characters, and similar) /[[:lower:]]/ Lowercase alphabetical character /[[:print:]]/ Like [[:graph:]], but includes the space character /[[:punct:]]/ Punctuation character /[[:space:]]/ Whitespace character ([[:blank:]], newline, carriage return, etc.)

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

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...

...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...

...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...

developer.mozilla.org

...full UTF-8 space, not just Latin/ASCII. For example, a password policy matcher might include regular expressions like [A-z] or [0-9], but those do not match e.g. German...

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...

...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)

...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...

...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

...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...

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...

...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

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...