The only way that a jQuery cache entry gets deleted is when you call remove() on the element that put it there! Since cache entries also have a pointer...

...pointer in the jQuery cache blocks its memory from being reclaimed. You need to call $element.remove() (or remove a parent element), to remove the entry in the jQuery cache and...

...default to ordering the records by id in ascending order during an ordered finder call. class User < ApplicationRecord end User.first #=> SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT...

github.com

...implicit conversion of a Hash argument into keyword arguments. This conversion is performed by calling to_hash on the last argument to that method, before assigning optional arguments. If to...

...keyword arguments ... then it is not set as the first optional argument. Instead, Ruby calls to_hash on the object and tries to match the result to keyword arguments. If...

makandra dev
impactahead.com

...situation" where you are "inside" an object. This is especially handy when needing to call private methods – just invoke them, no need to use send. Switch to an object: chws...

...freshly cloned project. The reason is your environment.rb which is loaded for Raketasks and calls Rails.application.initialize! which in turn may/will evaluate classes. If one of those classes is tries to...

# accessing "columns" raises an error and the application fails to boot. # # To allow calling "rake db:create" or "rake db:migrate" on an empty # database, we swallow such errors...

makandra dev

...the event from bubbling up the DOM, so you don't also need to call event.stopPropagation(). Note Everything below is legacy trivia about jQuery. We don't use that any...

...we want to stop in the debugger for all following tests, when the :lock call runs into the after_save $debug = true expect { user.lock }.to change(user, :locked).from(false...

...and even though you probably only care about seconds. This means that two consecutive calls of Time.now probably return two inequal values. Consider freezing time in your tests so it...

apidock.com

...may override the default accessors (using the same name as the attribute) and simply call the original implementation with a modified value. Example: class Poet < ApplicationRecord def name=(value)

...behaviors to your tests based on their type tag, for example enabling you to call get and post in specs with the tag type: :request. Alternatively you can skip these...

...How to get the path to ../CHANGELOG.md independent of the working dir of the caller changelog = File.read(changelog_path)

...further actions here Ruby >= 2.0 changelog_path = File.expand_path('../CHANGELOG.md', __dir...

simple_format ignores Rails' XSS protection. Even when called with an unsafe string, HTML characters will not be escaped or stripped! Instead simple_format calls sanitize on each of the...

makandra dev

...query param than foo, e.g. https://www.example.com/old_location?another_param=1. This is because url_for will call to_h on ActionController::Parameters, which will raise if there are unpermitted parameters.

When you mocked method calls in RSpec, they are mocked until the end of a spec, or until you explicitly release them. You can use RSpec::Mocks.with_temporary_scope to...

...are now responsible for cleaning up myScope when you're done with it, by calling myScope.$destroy(). Javascript's garbage collection will not do this for you.

# code to run if the expression changes This watcher will continue to be called indefinitely unless you clean up after yourself: observer = -> # observe expression unsubscribe = $rootScope.$watch observer, (new...

api.rubyonrails.org

...and its methods is not suggested in the usual in-app workflow, as validations, callbacks, custom getters/setters etc. are ignored. However, for database-centered stuff like migrations, these fill the...

...but can be used as if it were an array of hashes. You may call #to_hash or #to_a on the result, which both will return a real Array...

handle_unverified_request When Rails gets a request with wrong/missing CSRF-Token, it calls ApplicationController#handle_unverified_request and continues processing the request!. Per default, the method only resets...

...the session id when logging in. After authentication, but before writing to the session, call reset_session. (Know this also wipes all data from the session – which might be ok...

makandra Operations
manned.org

...on the source system to use the forwarded SSH agent --rsync-path "sudo rsync": Call rsync as root on the target system to allow writing the files

nolanlawson.com

...of memory leaks are APIs like these: addEventListener. This is the most common one. Call removeEventListener to clean it up. setTimeout / setInterval. If you create a recurring timer (e.g. to...

...it’s used like setInterval – i.e., scheduling a new setTimeout inside of the setTimeout callback.) IntersectionObserver, ResizeObserver, MutationObserver, etc. These new-ish APIs are very convenient, but they are also...

...you try order yourself. If you are on Rails 2.3, be aware that find calls inside the block are implicitly scoped. This is fixed in Rails...

...an optional database kwarg (specified using the model representative). It may be added by calling the indexer method on the DatabaseCleaner module: DatabaseCleaner[:active_record, db: Foo]. The DatabaseCleaner gem...

...executes your statement for each of them. This means whenever you use this direct call in your code, you actually perform this on a list of cleaners, there is no...

makandra dev
content.pivotal.io

} } } }) }) Usage expect(actualValue).toBeAnything(...matcherArguments) When a matcher is invoked, Jasmine will call its compare() function with the actualValue, followed by any arguments passed to the matcher. It...

makandra dev
github.com

...seconds to 168 milliseconds. Maybe it's a good time to stop and call it a day. If the JSON you are trying to build is fairly simple, you could...

...that it already owns? By writing it to the disk (or into a so called "materialized view"). First, tell PostgreSQL with a migration what the contents of this view should...

makandra dev

...does happen, so it might seam confusing why the IDP logout is not working. Calling current_user within the after logout route results in an exception This might show up...

...saml_authenticatable (at least up to version 1.9.1) has a bug there: If you call current_user when a LogoutResponse is present as an URL param it fails to parse...