[Rails] Re: rails 3.1 select multiple with serialized data
Happens every time - I find the problem after the post.
In the rails 3.0 version I capitalized the roles.
In the rails 3.1 version I lower cased the roles.
One of the few things I hate about ruby/rails case sensitivity.
On Aug 18, 9:05 am, AppleII717 <sa...@mac.com> wrote:
> In my Users model I have
>
> serialize :roles
>
> Letting it default to yml
>
> I enter roles as a text array. e.g.,
> u.roles = ["member","scorer"]
>
> It displays as an array
>
> @user.roles.type returns Array
>
> All is fine except if I try to use the select form helper to input the
> values with multiple => true
>
> I've tried several version and I can't get the set values to trigger
> selected in the options tag.
>
> f.select(:roles, options_for_select(role_options,@user.roles),{},
> {:multiple => true, :size => 5})
> f.select(:roles, role_options,{},{:multiple => true, :size => 5})
>
> (role_options is a helper method that return an array of valid role
> options.
>
> I had this working under 3.0, but using a kludge to put roles into a
> json hash.
>
> Steve
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home