Hi, Jason, welcome!

As you're building out your skills, I would refrain from looking for a gem
for this sort of functionality, as it's a good thing to learn in general
how to do.

You can do this pretty easily if you only want to allow one position at a
time:

<%= link_to "Staff", people_path(:filter_by => :staff), {:method => :get},
{:class => "button"} %>

for example, with one of these corresponding to each of the positions.
You'll need to create a CSS class for .button to make the link look like a
button.

On your PeopleController#index method, you'll need to check for a filter_by
parameter:

def index
  if params[:filter_by]
    @people = Person.where(:position => params[:filter_by])
  else
    @people = Person.all
  end

  # ... and whatever else you need to do to prepare for the view...
end

If you want to allow the user to select multiple of these, you'll need a
form with checkboxes or a multi-select.

I hope that's enough of a start.


On Mon, Feb 9, 2015 at 2:18 PM, Jason O <[email protected]> wrote:

> Hello all and thank you for your time and help.
>
> I am working on my first big project and one of the requests that I have
> is to host a directory list people, with the option to click from an array
> of buttons with the different position titles. Button examples being:
> Staff, Faculty, Grad Student, etc.  I have the index listing the full
> directory currently, but I was hoping someone would be willing to point in
> a direction to look for examples of how to set this up, or a gem that might
> be beneficial. I am researching on my own, but I do not feel I am finding
> quite what I am seeking.
>
> Thanks again for any help!
>
> Jason
>
> --
> 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/ade15b3b-b4fd-4224-9da1-6d0ee44bd0eb%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/ade15b3b-b4fd-4224-9da1-6d0ee44bd0eb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [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/CAHUC_t-Aj7AMwpCb_Tcq0PzRReDe3We-2EdZm7MomASP8SXOGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to