Ruby on Rails Sunday, September 28, 2014

Do you have any issues with the form currently ?

On Mon, Sep 29, 2014 at 7:35 AM, Paolo Wang <paulwangzy@gmail.com> wrote:
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 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/f1bcc415-a3b3-4b41-b860-71497f6779d2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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/CAFKVRj9qfErUuiBWtMeuhk4koJU7h_vSmOTv%2BeOXj8J_ibuSrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment