mysql - RoR user model to have multiple languages -


I'm editing devise user-generated model to add a language field for the user where one or more languages Speak from the combo box that can be added.

My question is what will be the best way to represent my SQL, I do not have the number of languages ​​that she speaks, so it can probably be up to 20.

I thought about making a model of a language which is Bhashaind, the language and language code and then use has_and_belongs_to_many with user model

I'm not sure That this is the right approach for this problem.

Any suggestions?

While you can do a Sirijlaijd array and selected all of a string on your user model languages Can Store

It depends on if you plan to use them stored language-user data, if you want to use them as search parameters, it means that you represent it To be an HABT should be

If you only have data to show on a user show page, and nothing else, then store it on a string or text attribute and serialize & lt; - de-serialize can work when necessary, though it may seem weird.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -