Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pass controller variable to my button on hover

I want to display my controller variable on hover of a button . I tried " :title => @variablename " but it doesnt seem to work

<%= link_to 'Refresh',
            '/dtr_refresh',
            id: 'refresh_dtr_link',
            class: 'btn btn-info',
            :title => @last_refreshed_time,
            remote: true %>
like image 452
m.beginner Avatar asked Apr 18 '26 00:04

m.beginner


1 Answers

You need to define your instance variable (@last_refreshed_time) on your controller, here is an example

class HomeController < ApplicationController
  def index
    @last_refreshed_time = Time.now
  end
end
like image 172
Javier Menéndez Rizo Avatar answered Apr 20 '26 20:04

Javier Menéndez Rizo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!