encoding: utf8 username: root password: secret Note if you're on an old Rails version If you're using a Rails version less than 3.1 (e.g. 2.3.x...

...Newer versions no longer include the ActiveRecord adapter (which is part of ActiveRecord since Rails .1). So your Gemfile should say:

techblog.netflix.com

top Also see: How to get a rough picture about a Rails project How to examine an unknown Ruby object

You may disable multi-line autocomplete by using the --nomultiline commandline switch (for Rails, use bin/rails console -- --nomultiline), or specifying IRB.conf[:USE_MULTILINE] = false in your ~/.irbrc.

...part is a bit lengthy, but it allows you to debug strange bugs with Rails autoloading the wrong constants. Due to the constant lookup rules above, Rails sometimes guesses wrong...

...in development and production, but the problem exist for both environment. Development During development, Rails unloads all classes after every request. This way code changes take effect immediately, without requiring...

makandra dev
litmus.com

...all styling inline, which means you'll have to do your styling inline. For Rails applications, you can use Roadie or premailer, which lets you keep your well-structured CSS...

...litmus during rendering. For a preview during develoment, you can also use your local Rails mailer previews. Take the preview HTML source and paste it to Litmus. When the builder...

makandra dev

You have to specify the environment with -e env_name or RAILS_ENV=env_name if you want to run a script on the server. at Rails 2 it's...

bundle exec script/runner -e env_name path/to/script.rb argument1 argument2 ... at Rails 3 it's rails runner RAILS_ENV=env_name bundle exec rails runner path/to/script.rb argument1 argument2...

User.active.to_sql Rails 2 Use either the Edge Rider or fake_arel gem to get #to_sql backported to Rails 2. If you don't want to use...

...a gem for this, you can do this with vanilla Rails 2: User.active.construct_finder_sql...

makandra dev

...and The...

...field should have the error...

...steps now have built-in support for Rails and Bootstrap (v3-v5) error classes. When using Bootstrap, it is no longer necessary to...

...block where you define replacements (as you already know). This issue applies to both Rails 2 (with rails_xss) as well as Rails 3 applications. Here is a fix to...

...html_safe.gsub(/(f)/) { puts $1; 'b' } f => "boo" Why? This is because of the way rails_xss implements "unsafe" methods: # vendor/plugins/rails_xss/lib/rails_xss/string_ext.rb UNSAFE_STRING_METHODS = [ ..., "gsub",...

for unsafe_method in UNSAFE...

...behaves like an unordered Hash, but is much faster. Info If you're using Rails you already have concurrent-ruby in your bundle. hamster hamster provides several collection classes, such...

makandra dev

...to append filepaths to it. With this method, Ruby code can look like this: Rails.root/"features"/"fixtures"/"picture.jpg" Alternatively you can use the #join method, which feels less magic: Rails.root.join...

makandra dev

There is a practical short list for valid/invalid example email addresses - Thanks to Florian L.! The definition for valid emails...

makandra dev

...Commit using a story title from Pivotal Tracker geordi con[sole] [TARGET] # Open a Rails console locally or on a Capistrano deploy target geordi cu[cumber] [FILES] # Run Cucumber features...

...PATH # Optimize .png files geordi ra[ke] TASK # Run a rake task in several Rails environments geordi re[move-executable-flags] # Remove executable-flags from files that should not be...

clipboardjs.com

...only of a single javascript file, so it does not trigger additional requests with rails it automagically provides user feedback by selecting the text it has copied it provides callbacks...

...modes like copying from a text field or from a data attribute How to (rails) Add clipboard.js to your project through bower or by downloading and adding the javascript file...

...class DynamicStylesheetsController < ApplicationController def show logical_path = RELATIVE_PATH_TO_YOUR_TEMPLATE path = File.join(Rails.root, logical_path) template = Sass::Rails::SassTemplate.new(path) environment = YourApp::Application.assets context = environment.context_class.new(environment, logical_path...

...these helper methods to your ApplicationController: class ApplicationController < ActionController::Base private def integration_test? Rails.env.test? && defined?(Cucumber::Rails) end def observable_redirect_to(url) if integration_test? render :text => "If...

makandra dev

The Rails asset pipeline improves delivery of application assets (javascripts, stylesheets, images, fonts). Here are some basic facts about its inner workings. No magic Manifests are the handle on your...

...results. You can do this locally using the following commands: rake assets:precompile # precompiles to Rails.root/public/assets rake assets:clobber # deletes the public/assets directory After precompilation, you can check the...

...entirely find out why, and we eventually did not care). This happened on a Rails 3.2 application and is likely to happen on Rails 4 applications as well. Your best...

If Rails or Rake are complaining about a missing gem that is listed in your Gemfile.lock and the listed version is properly installed, something is seriously wrong and needs to...

...seeing the gems it needs. Remove those wrong and unneccesary directories and Rake and Rails will boot again. To avoid this in the future, make sure everybody installs gems on...

...migration_user.phone ) end end end Now the best idea is to test this in the rails sandbox (so your development data stay untouched): rails console --sandbox 2.4.1 :003 > DataMigration.new.run

...add ANSI color annotations (which your console then interprets). To print a log (e.g. rails log) and color all lines containing "FATAL" in red and all lines with "INFO" in...

...more unreadable to more attributes you delegate. Alternative to def_delegators When working with Rails, use delegate...

...:to =>...

class Post < ActiveRecord::Base belongs_to :topic delegate :title, :category, :to...

end Looks a lot like the above def_delegators call but behaves differently. Rails does not provide a pretty solution to this, but simply write a method for it...

The asset pipeline is one of Rails' two mechanisms how stylesheets, javascripts and images from your /assets folder are processed and delivered to the browser. Rails has a second pipeline...

...webpacker, which we will cover later. Learn Read Everything You Should Know About the Rails Asset Pipeline Read How to make your application assets cachable in Rails Read Managing vendor...

Firefox 5.0.1, which we were using for most Rails 2.3 projects, does not run on Ubuntu 14.04 any more. Here is how to update affected projects. Update (or create) .firefox...

...run tests with Geordi, it will tell you how to install it. On a Rails 2 project: Update your Cucumber-related gems as described in Upgrading Cucumber and Capybara, including...