ruby on rails - Query about calling instance variables in view -
i'm calling following in application.html.erb view layout
<%= @time %>
and what's in application controller:
def time_now @time = time.current end
yet time not displaying on browser. helps?
thanks
are sure calling method time_now
somewhere in your, say, index
method?
e.g., try following in application controller (and make sure no 1 overriding method in subclass:
def index @time = time.current end
so if config/routes.rb
has root 'welcome#index'
, make sure welcomecontroller
not have index
method or calling super
applicationcontroller#index
method called set @time
.
Comments
Post a Comment