I’m trying give a “Welcome Message” to my users with that:
#welcome_controller.rb
class WelcomeController < ApplicationController
def hi
@current_user
if (@current_user)
@welr = '¡Bienvenido' + current_user + ' a nuestra web!'
else
@weli = "¡Bienvenido invitado, no dude en registrarse!"
end
end
end
#hi.html.erb Only the call
<%= hi %>
When I initialize my server the controller give me this message:
undefined local variable or method `hi’ for
I have tried many wways of repairing this but I can’t.
This article may help you :
Ruby on Rails: Accessing Controller Methods from Your View
Just write: