Lets say I have one two booleans and two integers. The two booleans behave as radio buttons. What I want to happen is to show all posts made when one boolean was true, and show all when the other was true. (I am new to ruby) and all I have is this <% @tests.each do |test| %>
<% if test.type1 == true %>
not sure how to show the separate variables
Showing posts only created when boolean was true
129 views Asked by Tyler Kann At
1
I believe what you're saying is you've got the logic down for showing these records, but you need to display the fields themselves. As such my answer will reflect this understanding.
If you're trying to display a record, you only really need to worry about HTML. This is from the Rails Guide:
All you have to do is arrange the HTML in a way you like, and insert your variables. Ruby data is added to an html.erb filve with
<%= ... %>
. Whatever the result of the code contained therein is inserted into the html. So if I want to display an integer from the object, I would just write<%= test.my_integer_1 %>
, and it would be the same as me simply typing that number into the html. Thus, if I wanted it to display as a header, I would instead type: