#42 with_options
Jun 08, 2007 | 3 minutes | Active Support
Several methods in rails take a hash of options as the last argument. If you are passing the same options to several methods, you can remove this duplication by using with_options. Learn all about it in this episode.
Thanks again, it is the highlight for the day, when I find a new episode.
太好了,谢谢恁!
Hey, great job on the screencast. I love watching your tips and tricks. One thing I have a question about though. Not to do with Rails, but rather Textmate. I noticed about 3/4 into the cast, that you selected "map." on two different lines, and then were able to edit both lines simultaneously... My jaw dropped on that one. Could you explain how you did that?
@Ben, the trick is to hold down the "option" key while you make a selection in textmate. This will switch it to column mode and allow you to edit multiple lines at once. After you make a selection you can hit "option" again to toggle back and forth. It's pretty useful. :)
makes so much sense now, thanks
test
Super !
Ryan, this site is amazing and I point developers to it whether they are newbies or experienced.
While watching this episode, I couldn't figure out which object actually gets passed to the block. It is worth noting that the object calling with_options is itself passed as the parameter to the block.
(http://dev.rubyonrails.org/browser/trunk/activesupport/lib/active_support/core_ext/object/misc.rb)
Hrmm that was weird, my comment got eaten. Anyway I wanted to say that its nice to know that someone else also mentioned this as I had trouble finding the same info elsewhere. This was the first place that told me the answer. Thanks.
Thank you!! this a big help
what would be the advantage of using with_options? does pose any additional security threats? or is it safe to use?