ruby fun

ok, let’s get straight into irb because REPL speaks a thousand words…

irb> %w_a b c_
=> ['a', 'b', 'c']

That was cryptic…try this

irb> %i_a b c_
=> [:a, :b, :c]

That save a whole bunch of keystrokes…how about this

irb> %r_a/b/c_
=> /a\/b\/c/

That makes regular expression with forward slash more readable…in fact there’s a whole slew of them %: %q, %x, %

ok, that’s enough fun for now.

 
0
Kudos
 
0
Kudos

Now read this

Devise Authentication unscoped

At Shop2 we do the Rails 3.2, Mongoid 2.4, and Devise 2.0. We found that Devise by default does not play nice with default scoping. # Our User model with default_scope of active users, # and a :vip scope # class User include... Continue →