Skip to content

Instantly share code, notes, and snippets.

@Parashar-xx
Created January 25, 2011 08:38
Show Gist options
  • Save Parashar-xx/794669 to your computer and use it in GitHub Desktop.
Save Parashar-xx/794669 to your computer and use it in GitHub Desktop.
Controller code..
def add
puts params[:srno]
edatabase = Club.find(:first, :conditions => [ "srno = ?", params[:srno] ]);
puts edatabase
if edatabase
edatabase.srno = params[:srno]
edatabase.fbuid = params[:fbuid]
edatabase.cbname = params[:cbname]
edatabase.fbname = params[:fbname]
edatabase.str_name = params[:str_name]
edatabase.cty_name = params[:cty_name]
edatabase.cou_name = params[:cou_name]
edatabase.pin = params[:pin]
edatabase.cb_tel = params[:cb_tel]
edatabase.hst_name = params[:hst_name]
edatabase.hst_tel = params[:hst_tel]
edatabase.lati = params[:lati]
edatabase.save
else
puts params[:fbuid]
edatabase = Club.new( :srno => params[:srno], :fbuid => params[:fbuid], :cbname => params[:cbname], :fbname => params[:fbname],:str_name => params[:str_name], :cty_name => params[:cty_name], :cou_name => params[:cou_name], :pin => params[:pin], :cb_tel => params[:cb_tel], :hst_name => params[:hst_name], :hst_tel => params[:hst_tel], :lati => params[:lati]);
edatabase.save
end
end
erb Code...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style type="text/css" media="all">
<!--
@import url("http://localhost:3000/style.css");
.style3 {font-family: "Times New Roman", Times, serif}
.style5 {font-family: "Times New Roman", Times, serif; font-size: large; }
-->
</style>
<body>
<h1>Clubs Details</h1>
<% form_tag "/clubs/list", :method => 'get' do %>
<table width="100%" border="2" align="left">
<tr>
<th align="left">Serial Number </th>
<td><%= text_field_tag :srno %></br></td> </tr>
<tr>
<tr>
<th align="left">Facebook Id</th>
<td><%= text_field_tag :fbuid %></br></td> </tr>
<tr>
<th scope="row" align="left">Club Name</th>
<td><%=text_field_tag :cbname %></br></td>
</tr>
<tr>
<th scope="row" align="left">Club Facebook Name</th>
<td><%=text_field_tag :fbname %></br></td>
</tr>
</table>
<p><table width="100%" border="2" align="left">
<tr>
<th scope="row" align="left">Club Address</th>
<td><%=text_field_tag :str_name %>&nbsp;,&nbsp;<%= text_field_tag :cty_n %>&nbsp;,&nbsp;<%=text_field_tag :cou_name %>&nbsp;,&nbsp;<%=text_field_tag :pin %>.</td>
</tr>
<tr>
<th scope="row" align="left">Club Telephone Number</th>
<td><%=text_field_tag :cb_tel %></br></td> </tr>
<tr>
<th scope="row" align="left">Latitude</th>
<td><%=text_field_tag :lati %></br></td>
</tr>
</table>
</p>
<table width="100%" border="2" align="left">
<tr>
<th scope="row" align="left">Host Name</th>
<td><%=text_field_tag :hst_name %></br></td>
</tr>
<tr>
<th scope="row" align="left">Host Mobile Number</th>
<td><%=text_field_tag :hst_tel %></br></td>
</tr>
</table>
<%= submit_tag "Add" %>
<% end %>
</body>
</html>
Started GET "/clubs/list?utf8=%E2%9C%93&srno=2&fbuid=guyg&cbname=ug&fbname=uy&str_name=gu&cty_n=uy&cou_name=gyu&pin=8787&cb_tel=8768&lati=876&hst_name=gigiug&hst_tel=76868&commit=Add" for 127.0.0.1 at Tue Jan 25 14:49:35 +0530 2011
Processing by ClubsController#list as HTML
Parameters: {"srno"=>"2", "commit"=>"Add", "cbname"=>"ug", "lati"=>"876", "cou_name"=>"gyu", "cty_n"=>"uy", "utf8"=>"✓", "hst_tel"=>"76868", "hst_name"=>"gigiug", "cb_tel"=>"8768", "str_name"=>"gu", "fbname"=>"uy", "fbuid"=>"guyg", "pin"=>"8787"}
Club Load (16.9ms) SELECT "clubs".* FROM "clubs"
DEPRECATION WARNING: <% %> style block helpers are deprecated. Please use <%= %>. (called from _app_views_clubs_list_html_erb__832283733_2174355200_0 at /Users/Define/Parashar/Test1/app/views/clubs/list.html.erb:14)
Rendered clubs/list.html.erb within layouts/application (31.7ms)
Completed 200 OK in 280ms (Views: 96.5ms | ActiveRecord: 16.9ms)
Started GET "/stylesheets/application.css" for 127.0.0.1 at Tue Jan 25 14:49:35 +0530 2011
ActionController::RoutingError (No route matches "/stylesheets/application.css"):
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.1ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment