Re: Filter objects with simple_form rails 3.1 and a select_box

70 views
Skip to first unread message

Carlos Antonio da Silva

unread,
Aug 10, 2012, 11:47:54 PM8/10/12
to plataformate...@googlegroups.com
I'm sorry, but I think I didn't get what you're trying to achieve with SimpleForm. You're trying to build a filter form, that'd filter a list of Orders based on the given Status? If that's the goal, I believe your question is rather about how to do that with Rails instead of SimpleForm related, because it has nothing to do with how the form is created.

Otherwise I'd ask you to extend a little bit your explanation on the problem so we can try to help.
Regards.

-- 
At.
Carlos Antonio

On Monday, August 6, 2012 at 1:33 PM, maserranocaceres wrote:

I have a `Order` object with a `status` attribute something like:

class Order
   include Mongoid::Document
   field :status, :type => String
end

The status attribute can have 11 values:

pa, ip, wr, cp, cb, sr, ex, io, co, ca, cca

In my index view I have a select something like:

<%= select(:order, :status, [["#{t('.order_pa')}", 1], ["#{t('.order_ip')}", 2], ["#{t('.order_wr')}", 3], ["#{t('.order_cp')}", 4], ["#{t('.order_cb')}", 5], ["#{t('.order_sr')}", 6], ["#{t('.order_ex')}", 7], ["#{t('.order_io')}", 8], ["#{t('.order_co')}", 9], ["#{t('.order_ca')}", 10], ["#{t('.order_cca')}", 10]]) %>

I want filter objects depending on the value that I send from **form**.

**How can I do this task with simple_form gem?**

Thank you very much!  

Reply all
Reply to author
Forward
0 new messages