0

I'm a novice to rails but I created a group of categories with the intention of using them as a filter for items in my application. However in listing them it seems like data that should be console only is showing up in my view. How do I get rid of this? What shows in the view

The code in my view are as follows:

<%= State.all.each do |state| %>
<%= link_to state.status, tickets_path(state: state.status) %>
<div class="badge">
<%= state.tickets.count %>
</div>
<% end %>

Where State is my "category" and Status is the "category name" and Ticket is the form submission or "item" so to speak.

Uncle Hank
  • 15
  • 1
  • 5

1 Answers1

1

<%= State.all.each do |state| %> delete the '=' and its done.

  • It helps to provide an explanation for _why_ that works. The reason it works is because in ERB `<%= %>` means "render the return value of the Ruby code following the `=` sign," while `<% %>` means "execute the Ruby code following the `=` sign but do not render its return value." [More info elsewhere on stackoverflow.](https://stackoverflow.com/q/7996695/3784008) – anothermh Oct 18 '18 at 00:45