...mail (or even password reset e-mail), or something similar. The e-mail also includes some reflected text. For example, a user may be able to give their name, and...
...is used within the e-mail. The spammer will then abuse that text to include his advertisment. Potential counter measures are: Add a captcha. Rate limit the sign-up or...
Our applications not only need to be functional, they need to be fast. But, to quote Donald Knuth, premature optimization...
...e.g. all attributes need to be present when initializing an object. Example: class User include ActiveModel::Attributes attribute :salutation attribute :first_name attribute :last_name attribute :street_and_number
Add zip_tricks to your Gemfile and bundle install. In your controller, include ZipTricks::RailsStreaming. You can then use the zip_tricks_stream method in controller actions to...
...own Last-Modified or ETag header to achieve that. Example controller: class DocumentsController < ApplicationController include ZipTricks::RailsStreaming def download documents = Document.all fresh_when Time.current # Sets `Last-Modified` header (see above...
...some benefits over placing fonts into your repo: All font weights and glyphs are included. You don't need to download and add files for latin, greek, cyrillic, or other...
...contain different unicode-range values which map different font files to the glyphs they include. This means that e.g. the file for cyrillic glyphs is only loaded when any text...
...Lockstep.synchronize end end Note that this method uses capybara-lockstep in the last line. Include this module in your test suite and call conclude_browser_requests at the end of...
...used (in development and tests)' do get 'http://www.example.com/test/set_cookie' response.headers['Set-Cookie'].should include('test=') # Cookie is still set response.headers['Set-Cookie'].should_not include('; Secure') end end
Consider the following example from the Modularity README: # app/models/article.rb class Article < ActiveRecord::Base include DoesStripFields[:name, :brand] end # app/models/shared/does_strip_fields.rb module DoesStripFields as_trait do |*fields| fields.each do |field|
...Modularity source code and understand how the implementation works. In particular, understand this syntax: include DoesStripFields[:name, :brand] What exactly is included here? How does Modularity enable parameterized modules? How...
...will fail when trying to compile their assets up front. class ApplicationController < ActionController::Base include EsbuildErrorRendering if Rails.env.development? end module ApplicationController::EsbuildErrorRendering ESBUILD_ERROR = Rails.root.join("esbuild_error_#{Rails.env}.txt") # see...
...you need to skip those items that are #marked_for_destruction?. Otherwise you will include items that have been ticked for deletion in a nested form. See ActiveRecord: When aggregating...
...have an indefinitely high resolution). When ordering lists by timestamps, you should therefore always include a final order condition using the primary key of the table. class Photo < ActiveRecord::Base...
...scope :by_date, -> { order('created_at DESC, id DESC') } end Photo.by_date Remember to include the id field in the database index...
...you have the following code: module Mod def foo @@foo end end class Klass include Mod end @@foo does not mean Klass::@@foo (qualifier added to make my point; it...
...Ruby expression). It actually means Mod::@@foo and is shared between Mod, all classes including Mod as well as all their subclasses. Also note that only the class and module...
...movie form, I should be able to select the inspiring movie. The list should: include all the movies that were released in previous years not include the movie itself
...include a movie that was itself inspired by the movie that is being edited. Traversal In the movie show view, I want to see the "inspiration tree" of that movie...
...your particular development server shows an error. Warning Unpoly cannot repeat form submissions that include file inputs. If it tries, the file data will be replaced with the string [object...
...To avoid confusion, this code will instead redirect to /__better_errors when a file is included in the submission. // Only do this in development. This requires a `[data-environment="development"]` attribute...
...them like this: *, :before, :after { transition-property: none !important; animation: none !important; } To only include these styles for tests, see Detect the current Rails environment from JavaScript or CSS.
4 0 - 5 Dev machines are not blocked on test runs; Code Reviews include test badge; Automatically merge a PR on green tests Upgrade Rails 5 0 - 5
...a list of acceptance criteria and (optionally) some additional notes. The introduction sentence should include the role of the user, what the user wants and why. The acceptance criteria are...
...client: Make a POST request with method override The default configuration Rails and Sinatra includes a Rack middleware that lets you control the HTTP method used for routing by POSTing...
...See https://thepugautomatic.com/2013/07/dsom/ module WithModuleInheritance def with_module_inheritance(&block) anonymous_module = Module.new include anonymous_module anonymous_module.module_eval &block end end Module.include(WithModuleInheritance...
...also need to override some methods, you can do this: class HelperProxy < ActionView::Base include ApplicationController.master_helper_module def current_user #let helpers act like we're a guest
Bare metal If you have strong nerves, you can also try to include the ApplicationController.master_helper_module directly into your model...
...power that specifies which deals and documents are accessible by a user: class Power include Consul::Power power :deals do Deal.where(author_id: user.id) end power :documents do admin? ? Document.all...
...in an error like does not implement: current_power. The documentation on dynamic classes includes some ways to fix this by showing how dynamically defined attribute methods from ActiveRecord are...
...BS 2+3, but not above there are some forks which say that they include a BS4 renderer, but they didn't work for me. Suggestion: Remove simple-navigation and...
...or overwrite the styles by using bootstrap variables. Upgrade Phase 1 First you should include the new version into your project and replace the old imports, e.g. with webpack
...then((latitude) => { done(latitude) }) JS expect(returned_latitude).to eq latitude end When we include this step into a scenario and run it, it will fail because StreetMap is not...