Ruby on Rails Wednesday, December 19, 2012

Hi Crispin Schäffler,

Good Day !

As you said i followed your instructions, but i got an error..

It is my application controller,

class ApplicationController < ActionController::Base
  before_filter :track

def track
  trackobject = Track.new(:date => Time.now, :ip => "#{request.env['REMOTE_ADDR']}") unless session[:tracked] 
 session[:tracked] = true 
end

end
r
Please advice!

Thank you.


On Wed, Dec 19, 2012 at 3:01 PM, Crispin Schäffler <crispinschaeffler@gmail.com> wrote:
def track
  trackobject = Track.new(:date => Time.now, :ip => "#{request.env['REMOTE_ADDR']}") unless session[:tracked] (and again what you want to have
 session[:tracked] = true (if you want that visitor only tracked once on your page
end



--
"Attitude is a little thing that makes a big difference"

Thanks & Regards
Ashokkumar.Y
ROR-Developer
email : ashokkumar@shriramits.com
Shriramits



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment