Helps
“Can I use
after_initializeto set up nested associations for use withController#newactions?”
Not recommended. It is better to write a custom #new_for_form method in your model that pre-populates your instance variables with the 1 or more nested objects. That way you can test drive it, too.
“DelayedJob YAML parser in Ruby 1.9 is having issues.”
The compiled-in psych library has issues, use the tenderlove/psych gem instead. You have to use Bundler, however. Invoking require "psych" will use the compiled-in version.
“RubyMine is not honoring a DVORAK keyboard layout properly (it is mapping keyboard shortcuts to the QWERTY layout)”
Use a hardware dongle.
“Jenkins is trying to kill off Postgres?”
Does anyone have Jenkins CI working with Postgres? It seems that after a build is complete, some java deep down inside Hudson is trying to parse the process table, and it is choking on the Postgres entries. (Postgres re-writes ARGV[0] to display status info, you can’t rely on it be the original command line.) It remains a mystery why Jenkins would even need this information.
“Is anyone using Chrome in CI? The windows are transparent”
Sounds pretty. Odd, but pretty.
Interesting
“brew info … is your friend”
Can’t remember how to start or stop a daemon under OS X? If you installed it via Homebrew you are in luck:
brew info <foo>
Will print out the original install instructions, including exact lines to pass to launchctl(1), etc.
“More ‘special’ keywords to avoid in your models:
targetandsource“
ActiveRecord Polymorphic Associations use a method called target internally. If you have an attribute in your model / database, also called target, then strange things will happen.
“Paperclip’s
<model>.attachment.exists?is slow; it goes out to S3 (or whatever the store is)”
And it happens in strange places. Be warned. Or mock out your network calls.
Regarding launchctl, you can also use my lunchy gem which turns this:
launchctl load ~/Library/LaunchAgents/io.redis.redis-server.plist
into this:
lunchy start redis
More info here:
https://github.com/mperham/lunchy
May 20, 2011 at 4:05 pm
> It is better to write a custom #new_for_form method in your model that pre-populates your instance variables with the 1 or more nested objects. That way you can test drive it, too.
That’s a great idea! Might I also suggest instead using a method `#prepare_for_form` which does that work and returns `self`? Then you can call:
@post = Post.new.prepare_for_form
or
@post = @user.posts.build.prepare_for_form
Also, sometimes which associations should be filled out is highly dependent on which form you’re rendering. In that case, you may want to use a form-backing object:
< https://pivotallabs.com/users/jdean/blog/articles/1706-form-backing-objects-for-fun-and-profit>
May 22, 2011 at 8:05 am