skip to main
|
skip to sidebar
{object: literal}
Tuesday, August 14, 2012
Passing array of elements as multiple arguments in a ruby method
Suppose we wanna pass an array of elements like this
keys = %w{ user_id shop_id url title shop_name }
Then we need to prepend the variable with * as arguments
Shop.slice(*keys)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Blog Archive
►
2014
(5)
►
May
(1)
►
March
(2)
►
February
(2)
►
2013
(6)
►
November
(3)
►
February
(2)
►
January
(1)
▼
2012
(42)
►
December
(2)
►
November
(1)
►
October
(9)
►
September
(1)
▼
August
(9)
Add index on PostgreSQL table column for in-built ...
Upgrade Heroku db to new PostgreSQL Dev addon
Restarting crashed workers in Heroku
Configure PostgreSQL full-text search using pg_sea...
Run delayed jobs on Heroku with queue names
Transfer domain from a Heroku Zerigo account to an...
Share methods between controller and views in Rails
Passing array of elements as multiple arguments in...
Multiple heroku apps on different subdomains manag...
►
July
(3)
►
June
(7)
►
May
(4)
►
March
(1)
►
February
(4)
►
January
(1)
►
2011
(29)
►
December
(1)
►
October
(2)
►
September
(2)
►
July
(1)
►
June
(2)
►
May
(3)
►
April
(2)
►
March
(2)
►
February
(3)
►
January
(11)
►
2010
(102)
►
December
(21)
►
November
(5)
►
October
(3)
►
September
(4)
►
August
(3)
►
July
(5)
►
June
(5)
►
May
(10)
►
April
(5)
►
March
(17)
►
February
(12)
►
January
(12)
►
2009
(143)
►
December
(1)
►
November
(10)
►
October
(26)
►
September
(68)
►
August
(20)
►
July
(15)
►
April
(3)
►
2008
(2)
►
March
(2)
No comments:
Post a Comment