Ruby on Rails
Monday, April 30, 2018
I've been putting options for select lists in my models but I haven't been able to do this with option/value pairs Anyone know how? The code below doesn't work
-- DURATION_TYPES = [['7 days', '7' ],['14 days', '14'], ['21 days','21'], ['30 days','30']]
validates :duration, inclusion: { in: DURATION_TYPES }
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c04d58fa-0e5b-42f8-8d80-20375f07f98c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment