Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # ERB
- #
- # <% years = (Date.today.year..Date.today.year + 12).collect %>
- # <%= f.select(
- # 'ccexpy',
- # years.zip(years.collect {|y| y.to_s[-2,2]}),
- # {},
- # { :class => "expirydate" }
- # ) %>
- #
- # EXPECTED VALUE OF years:
- #
- # [
- # [2011, "11"],
- # [2012, "12"],
- # [2013, "13"],
- # [2014, "14"],
- # [2015, "15"],
- # [2016, "16"],
- # [2017, "17"],
- # [2018, "18"],
- # [2019, "19"],
- # [2020, "20"],
- # [2021, "21"]
- # ]
- #
- # Pure Ruby example (no ERB)
- #
- years = (Time.now.year..Time.now.year + 12).collect
- p years.zip(years.collect {|y| y.to_s[-2,2]})
Add Comment
Please, Sign In to add comment