On 25 January 2016 at 10:15, Matti Ezzat <lists@ruby-forum.com> wrote:
> Hi everyone...
>
> I have an application in rails, and I need help in something...
>
> my application has two buttons one is to suggest a restaurant with vegan
> and another without vegan food, the search is working but what I want is
> that the buttons of non vegan should only search is the check_box is 0
> thats mean false, the same thing for the suggest with vegan button
> should only show the results of the check_box 1 or true..below are my
> codes
>
> in Controller
> def redirect_to_random
> @restaurant = Restaurant.offset(rand(Restaurant.count)).first
> render 'show'
> end
>
> def redirect_to_random_vegan
> @restaurant = Restaurant.offset(rand(Restaurant.count)).first
> render 'show'
> end
>
>
> in the view
> <div class="field">
> <%= f.label :vegan %>:
> <%= f.check_box :vegan %>
> </div>
> as Boolean
Please be more specific about what help you need. Is it that a
particular bit of your code is not working, or is it that you don't
know how to implement a particular feature? For example your question
talks about a checkbox. Is it that you don't know how to access the
checkbox value from the code or is it that you are getting an error
when you run the code, or is it that you can access the value ok but
don't know how to do the search? Or what?
Colin
--
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/CAL%3D0gLuSLQmagNcnUz3aeDxunV5q-TMKwPQNMteHVaa8Gx7-9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment