git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "2.7.6" gem "rails", "~> 7.0.6" gem "sqlite3", "~> 1.4" gem "puma", "~> 5.0" This blocks automatic updates of rails, sqlite3 and puma...
git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "2.7.6" gem "rails" gem "sqlite3" gem "puma" All gems are easily updateable with bundle update Good source "https://rubygems.org...
RubyGems 1.6.0 has undergone some changes which may cause Rails 2.x applications to break with an error like this one (e.g. when running script/server): /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport...
...the error above you can also add require 'thread' in your boot.rb after the RAILS_ROOT constant was defined. RAILS_ROOT = "#{File.dirname(FILE)}/.." unless defined?(RAILS_ROOT) require 'thread...
...saving etc), do this: Model._save_callbacks.select {|cb| cb.kind == :before}.map{ |c| c.instance_variable_get :@filter } Rails 2 User.after_save_callback_chain To look at the method names only, you could do...
...of Carrierwave and Capybara, has released Refile, a gem for handling file uploads in Rails. It handles direct uploads (also direct uploads to Amazon S3) better than Carrierwave.
...for a gem, e.g. when you want to see if there is a newer Rails 2 version of your currently used gem. At first you should search your gem at...
rack-mini-profiler is a powerful Swiss army knife for Rack app performance. Measure SQL queries, memory allocation and CPU...
Amazing guide how to divide a ball of Javascript spaghetti distinct separate layers (model, view, controller, backend adapter).
Previously the assets group existed to avoid unintended compilation-on-demand in production. As Rails 4 doesn't behave like that anymore, it made sense to remove the asset group...
How delayed jobs can make your after_save callbacks execute before the record is saved.
There is now a solution.
Free Hoptoad/Airbrake alternative which can capture exceptions from any platform. It comes with a Rails notifier and a RESTful API to write your own notifiers for Javascript, etc.
...animation: none !important; } To only include these styles for tests, see Detect the current Rails environment from JavaScript or CSS. Disabling animations in Unpoly In Unpoly you can globally disable...
...argument('--disable-smooth-scrolling') Related cards Does or scroll the page? Detect the current Rails environment from JavaScript or CSS Disable concurrent AJAX requests in tests In applications that do...
To only run the next two migrations: rake db:migrate STEP=2 To revert the previous two migrations:
Shoulda Matchers don't provide canditional validations (validations with if: option). Here is how to write tests for the condition...
...to add associations across those records, if they are related in some way. The Rails sandbox In development, Rails' sandbox mode might be useful. Testing and the migration codebase
...to deliver a real Unit object, whereas form.select :unit_id, Unit.for_select will make Rails typecast the String value from the select field to the unit's ID...
...my application' end end test_routes = Proc.new do get '/my_application' => 'my_application#show' end Rails.application.routes.eval_block(test_routes) Put it into a place like spec/support/test_routes.rb, or a similar place that...
The rack-contrib gem brings a JSONP middleware that just works™. Whenever a JSON request has a callback parameter, it...
Updated the card with our current best practice (shared app code and specs via symlinks).
Installation differs slightly from older versions, please check the README.
Nice article to educate your non-geek girlfriend/boyfriend about the joys of programming.
You can quickly access views that belong to a controller by using the tiny "page with arrow" icon in the...
You set a flash message and it shows up as it should. However, it is displayed again the next time...
content_type_1.match(/\Aimage\/(jpeg|png)\z/) # => nil content_type_2.match(/\Aimage\/(jpeg|png)\z/) # => Rails Newer Rails explicitly warns you, when you use ^ and $ in validations with a regular expression...