Re: [Rails] set user IP on create

2011-07-21 Thread Curtis Schofield
On Jul 21, 2011, at 10:51 AM, Tomas R. wrote: > so how should I add the IP? assign it on the controller or maybe a > hidden text field? > http://lmgtfy.com/?q=rails+ip+address You'll have access to the request in the controller. > -- > Posted via http://www.ruby-forum.com/. > > -- > Y

Re: [Rails] set user IP on create

2011-07-21 Thread Tim Shaffer
Yep. Models don't (and probably shouldn't) know about the request at all. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/uFAHfY9wlIcJ. To post t

Re: [Rails] set user IP on create

2011-07-21 Thread Colin Law
On 21 July 2011 17:33, Tomas R. wrote: > i tried to make a callback to assign the user IP address on create > > before_create > self.ip = request.remote_ip > end > > but I get > > NameError (undefined local variable or method `request' for > #): I think (though not certain) that request is only a

[Rails] set user IP on create

2011-07-21 Thread Tomas R.
i tried to make a callback to assign the user IP address on create before_create self.ip = request.remote_ip end but I get NameError (undefined local variable or method `request' for #): -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the