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
--
Posted via http://www.ruby-forum.com/.
--
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/6fea9c463c2bb768ae69c24b81b4c374%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment