Ivan Kutsarov
Ivan Kutsarov

Reputation: 1031

Add time display bar on Rails page

I need to display the local time which is based on a local timezone of the user visiting my page. Recently I added this code to my application_controller.rb file:

class ApplicationController < ActionController::Base
  protect_from_forgery
  helper_method :date_loaded
  def date_loaded
    Time.now
  end
end

I am very new to Rails and not sure what to do as a next step. Should I add <%= @date_loader %> string to my application.html.erb and then create a bar in which time will be displayed using my application.css.scss file?

Upvotes: 1

Views: 300

Answers (1)

tadman
tadman

Reputation: 211670

This seems reasonable. It's not clear why you need a helper method for the current date, though.

Upvotes: 1

Related Questions