Dynamic Attributes in Python Model Class
class Bar():
def __init__(self, **args):
for key in args:
self.__dict__[key] = args[key]
b = Bar(fullname="Monty Python", email="me@monthpython.org")
b.fullname #=> Monty Python
b.email #=>me@montypython.org
Written by Sean Behan on 06/17/2012
git checkout -- file-in-question.oh-my
Problem: using git and one file, like your db/schema.rb, is out of whack with the latest branch. If you run git pull and you get a failed merge and no update. You can of course, edit the conflicts manually. But what if you're confident that the latest sch...
Written by Sean Behan on 06/17/2012
David Heinemeier Hansson - Ruby on Rails, Startups, Culture
[youtube]http://www.youtube.com/watch?v=sb2xzeWf-PM[/youtube]
Written by Sean Behan on 06/17/2012
Yield a Block within Rails Helper Method with Multiple Content_tags Using Concat
To clean up some repetitive html coding in views, pass a block of text to a helper function which will wrap it for you the same way, each and every time. For example, I have a 'help' link which will toggle the display of a block of text if a link is click...
Written by Sean Behan on 06/17/2012
Postfix, ActionMailer and OpenSSL Fix on Ubuntu
If you run into problems using ActionMailer > 2.2, Postfix and OpenSSL while sending mail from your application, try changing the following:
vim /etc/postfix/main.cf
Change
smtpd_use_tls=yes
to
smtpd_use_tls=no
OpenSSL support with Postfix does ...
Written by Sean Behan on 06/17/2012