Click here to Skip to main content
15,886,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am a newbie in Ruby On Rails and i want to insert IP address and current time to database. I have shown IP address and time on view,now i want to insert these values on sqlite

My view code:

<%= form_for(@emps) do |f| %>
XML
IP:   <%= f.label require 'socket'
        ip=Socket.ip_address_list.detect{|intf| intf.ipv4_private?}
        ip.ip_address  %><br>


 Current Time:
        <%= f.label t = Time.now
        t.strftime("%I:%M%p")  %>

  <%= f.submit  id: 'checkin', name:'action', value:'CheckIn'%>


OnController:

SQL
def index
      @emps= Ems.new
      @emps.save
 end




i want to insert these ip and time in database sqlite. please help me
Posted
Updated 6-May-14 21:07pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900