Thank you very much.
Using 'Language.all.permutation(2).
to_a' I've got all the combinations (A->B and B->A) and seeded the
LanguagePair model. For the cost I was thinking to puts a decimal column in
the LanguagePair model.
At the moment I am working on the form(inside the lineitem views):
<div class="field">
<%= label_tag :from, "Source Language" %><br />
<%= select_tag :from, options_for_select(@from_lang), {id:
'source_select'} %>
</div>
<div class="field">
<%= label_tag :to, "Target Language" %><br />
<%= select_tag :to, options_for_select(@to_lang), {id: 'target_select'}
%>
</div>
and LineItem controller:
def new
@line_item = LineItem.new
@from_lang = Product.uniq.pluck(:from)
@to_lang = Product.where(from: @from_lang.first).pluck(:to)
end
I haven't got a lots of experience with Rails and I am always searching for
a better ways to write things.
Regards
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/f1bcc415-a3b3-4b41-b860-71497f6779d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.