tbuser's acts_as_pradipta at master - GitHub
What Pradipta Archiputra (aka "MAX ARCHIE") uses to send his recruitment emails. This plugin pretends that CC and BCC
Railscasts - Embedded Association
Learn how to set up a one-to-many or many-to-many association which is entirely embedded into a single column through a string or bitmask.
sinsiliux's Blueprints at master - GitHub
Another replacement for factories and fixtures that focuses on being DRY and making developers type as little as possible.
acunote's template_inliner at master - GitHub
Template inliner avoids the problem when to render a large list of objects,
CSS Rant -- 5 tips for rails developer sanity - Momoro Machine
Fuck acronyms, really
cwninja's inaction_mailer at master - GitHub
An ActionMailer delivery method to save mails as files in a directory.
cwninja's popthis at master - GitHub
So you downloaded inaction_mailer, and you had a folder full of e-mails generated while writing your app?
elevation's event_calendar at master - GitHub
Easily show multiple, overlapping events across calendar days and rows.
pjdavis's identity-map at master - GitHub
A simple implementation of an Identity Mapper for Active Record.
How to split a Ruby class into multiple source files - Gem Session
Unfortunately vanilla Ruby modules lack support for many idioms popular in modern Ruby. Most importantly, we have become accustomed to composing our classes with meta-programming macros such as has_many, validates_presence_of or after_save. And modules weren't built with macros in mind.
datagraph's rack-throttle at master - GitHub
Rack middleware for rate-limiting incoming HTTP requests.
jnicklas's carrierwave at master - GitHub
File upload solution that supports form roundtrips when a validation fails.
Handy! RGB to HSL and RGB to HSV color model conversion algorithms in JavaScript - Axon Flux // A Ruby on Rails Blog
Here is a set of additive color model conversion algorithms that I found published on Wikipedia and have implemented in JavaScript.
Sailing down the Hudson with RVM - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS
We recently decided our CI server needed an overhaul. I really enjoyed Integrity as a build server, but after trying out Hudson it’s hard to say I want to go back. Hudson has several huge advantages.
Ultimate rspec matcher to test named_scope or scoped - Web development blog
What do we expect from the custom finder? We expect that it should find assets A, B, C and should not find assets D, E, F. And sometimes the order is important: it should find A, B C with exact order.
Insertion/Deletion callbacks
All ActiveRecord associations except for has_many :through support callbacks for pre- and post-insertion/deletion via the following, self-documenting parameters:
Rails: Have different session secrets for all environments
The Rails secret_token must be unique for each application and any instance of it. If not, someone could exploit this by creating a user with ID = 1 (e.g. on staging), sign in and then use that cookie to authenticate on another site (e.g. on production, where the user with ID = 1 probably is the admin).
Here is a one-for-all solution that does not affect current production users, leaving the production token unchanged: prefix the existing secret_token with #{Rails.env unless Rails.env.production?}.
Note: There may be tokens in ...
Make your Rails console (and irb) output better readable
Pour color on your Rails console with awesome_print. Turn confusing long strings into formatted output. Have objects and classes laid out clearly whenever you need it.
Put gem 'awesome_print', :group => :development into your Gemfile. Now on the Rails console you have the command ap that will give you a colored, formatted output of whatever you pass it. See the example output of the User class below.
For customization visit the repository on Github.
 is great. Anyone can use virtually any open-source code in their projects."
Well, it depends. Licenses can make things difficult, especially when you are developing closed-source software. Since some OSS licenses even require the employing application to be open-sourced as well (looking at you, GPL), you cannot use such software in a closed-source project.
To be sure on this, we have developed a project-level integration of Pivotal's excellent [license_finder](https:/...
Using ActiveRecord with threads might use more database connections than you think
Database connections are not thread-safe. That's why ActiveRecord uses a separate database connection for each thread.
For instance, the following code uses 3 database connections:
3.times do
Thread.new do
User.first # first database access makes a new connection
end
end
These three connections will remain connected to the database server after the threads terminate. This only affects threads that use ActiveRecord.
You can rely on Rails' various clean-up mechanisms to release connections, as outlined below. This may...
How to use html_safe correctly
By default, Rails views escape HTML in any strings you insert. If you want to insert HTML verbatim, you need to call #html_safe. However, #html_safe does not "unescape" a string. It merely marks a string as safe for unescaped insertion.
How html_safe works
Calling html_safe on a String returns a new object that looks and acts like a String, but actually is a ActiveSupport::SafeBuffer:
"foo".length
# => 3
"foo".class
# => String
"foo".html_safe.length
# => 3
"foo".html_safe.class
# => ActiveSupport::S...