I’ve just started my own rails project from scratch. I’m trying the view to display hello if the minutes variable is set to a certain value.
The code is in the controller right now, and I want it to display the output in the view. is this possible? or do I write it in the view? Not sure of doing it right.
home_controller.rb
class HomeController < ApplicationController
def index
@minutes = 23
@minutes = params[:minutes]
end
end
index.html.erb
<% if @minutes == 23 %>
<%= "helllo" %>
<% else %>
Anonymous
<% end %>
1 Answer