Maybe a stupid question but is it possible to use Symbol to_proc even for methods which need an argument?
Nope, it only works on very simple method calls which don't take an argument. Anything more complicated and you will need to use the full block.
Ryan,
Can more than one attribute be combined / concatenated ?
e.g. :
Something like ... (this doesn't work) :
ActorNames = Actor.find(:all).collect(&:last_name + ' ' + &:first_name)
.. neither does :
ActorNames = Actor.find(:all).collect(&:last_name,&:first_name)
Mike
@Mike, nope, you can only call a single method with Symbol to_proc. If you want to combine two methods like you're trying to do, I recommend creating a new "full_name" method in the actor model to do this. That way you're back to calling one method.
Before your readers subscribe to this method, they should be aware of the performance issue.
http://m.onkey.org/2007/6/30/let-s-start-with-wtf
Apparently, nothing beats a good olf-fashioned block
Two ways to do :
1.find(:all).map{|t| t.name}
2.find(:all).collect(&:name)
Symbol to_proc. If you want to combine two methods like you're trying to do, I recommend creating a new "full_name" method in the actor model to do this.
Keep it short and simple. This is what you do!
Your do have some unique ideas here and I expect more articles from you.
We are selling all kinds of moncler jackets,moncler coats,moncler vests,moncler shirts and so on,all of our products are at high quality and low price,and they are free shipping.
Great site. This could probably have the refactoring tag added t it.
Great site. This could probably have the refactoring tag added t it.
It's a very meaningful activity. Looking forward to joining you.
Very interesting and useful information! It's pity that such occasions are still exist in the world, but we should act all together for to prevent them. Thanks.
thanks for the tips,very useful. Thanks for sharing it.
Well, it is very useful information shared. Thanks a lots.
Thanks for putting this in a clear concise format. I appreciate it!
to_proc Symbol. If you want to combine two methods that you try to do, I recommend you create a new "FULL_NAME" model of the actor method to do this.
It is the tears of the earth that keep here smiles in bloom.
comes housed in a black plastic case with stainless steel lugs at each side. The black
wristband is nicely crafted from leather, and in case you plan on banging your new watch
around a bit, the display is protected by a durable, scratch-resistant mineral crystal
face.
Hi Ryan -
Great stuff, but be careful.
Its lucky all your passwords are 'secret'.
You set up a table in the Outline, but you use literal text in the steps!
Your blog keeps getting better and better! Your older articles are not as good as newer ones, you have a lot more creativity and originality. Now keep it up!
Wow. This blog is truly a gold mine. I have been wallowing on this for quite sometime and here I am reading about it! I will actually try these tips and let you know how they work out! Thanks again mate.
Thank you for the sensible critique. Me and my neighbor were just preparing to do some research about this. We got a grab a book from our local library but I think I learned more from this post. I am very glad to see such great information being shared freely out there.
Hello admin, good day. Excellent post. You have gained a new subscriber. Pls keep it up and I look forward to more of your cool articles. Sincerely, Chris.
Thanks for sharing your article. I really enjoyed it. I put a link to my site to here so other people can read it. My readers have about the same interets
I think this is a great post. One thing that I find the most helpful is number five. Sometimes when I write, I just let the flow of the words and information come out so much that I loose the purpose. It’s only after editing when I realize what I’ve done. There’s defiantly a lot of great tips here I’m going to try to be more aware of.






