Help
“How to test content_for in a view using rspec-rails 2?”
It looks like rspec used to have a convenience method for testing what was passed to a content_for in a view. What are the options for testing this? One option is rendering the entire view in a controller test using render_views and testing the content there.
Mocking out the call to content_for would be nice, but it’s difficult to get a hold of the view object which this method is called on in your view.
“What do you recommend for autoresizing textareas as users interact with them?”
A few projects are using Autogrow Textarea.
This one looks nice as well, though I haven’t a chance to use it besides the demo on the page.
Interesting
“apply @font-face directly to elements containing text, not their parents”
Looks like you might get some unexpected aliasing artifacts with @font-face if you don’t heed the advice given above.
“fields_for: child-index vs. index?”
You might come across
f.fields_for :object, :child-index: => i
or
f.fields_for object, :index => i
when you’re making many fieldsets. What’s the difference?
As you might notice above, the form helpers use child-index for the indices on the inputs when the object to render fields for is a symbol (or a string), and index when passed an actual object.
–
Now for some gems that some Pivotal folks have found useful recently
validates_timeliness for your date and time validation needs
hash_syntax converts hashes between the
:key => valueandkey: valuesyntax (or the other way).
Events
Yoga tonight. Stay cool over the weekend!