- Ruby MRI seems to have taken a step back in time, a dangerous, but useful feature (to some) is the goto statement.
It appears that DateTime object has some issues with doing math.
DateTime.now - 1.hour #raises TypeError DateTime.now - 3600 #works as expected 1.hour.class #Fixnum
Reading the CSS property
background-positionin Chrome returns an invalid value. Don’t rely on it.
- Github was hacked! They had a security issue that was a result of
attr_accessiblebeing uses incorrectly. Remember to authorize your SSH keys.
- Need help with cron? Use http://cronwtf.github.com to convert cron into friendly English.
not. It is highly recommended to always use the strict logical operators (
!) because the keywords
not) don’t have the same operator precedence.
- When evaluating variables in strings with
bash, its better to use
$var. The curly-brace allows you to evaluate a variable with copy behind it. For example,
$varasdfevaluate differently because of the expected variable name.
Rails <3.1 has some gotchyas when using
class Note < ActiveRecord::Base has_many :contacts, inverse_of: :note end class Contact < ActiveRecord::Base belongs_to :note, touch: true #for triggering the note observer when the contact is updated end class NotObserver def after_touch(note) note.contacts # does not have the new attributes updated unless you specify the :inverse_of end end # Somewhere in the code... contact.update_attributes....
When table names are not namespaced on a class. What is the best way to work with this if we want table names to be namespaced?
class Foo::Bar < ActiveRecord::Base end > Foo::Bar.table_name == "bars" true