回収会社詳細のフォームを作成しました。フォームの詳細が保存されている場合、それは
次のページにリダイレクトされます。私の問題は、保存ボタンをクリックした後、リダイレクトされますが、「接続がリセットされました」と表示されることです
私のroutes.rbファイル
get 'companies/new'
match 'companies/create' => 'companies#create' , :as => "create_companies_path" , :via => "post"
match 'companies/upload' => 'companies#upload'
resources :companiesde
私の最新の開発ログの詳細
Started POST "/companies/create" for at 2013-05-09 11:24:02 +0530
Processing by CompaniesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"J7AnRNRpqHGvPTzc1qlbn9/X5ITA8T0HaibAgqD+qrI=", "companies"=>{"f_name"=>"Ghayathri", "l_name"=>"Angamuthu", "email"=>"aghayathri@gmail.com", "password"=>"[FILTERED]", "c_password"=>"[FILTERED]", "c_name"=>"FixNix", "location"=>"Chennai", "m_number"=>"9566735440", "isms"=>"Yes", "no_empl"=>"1", "date_started(1i)"=>"2013", "date_started(2i)"=>"5", "date_started(3i)"=>"9", "modules_list"=>"1"}, "commit"=>"Save Companies"}
[1m[35m (0.1ms)[0m BEGIN
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `companies` (`c_name`, `c_password`, `created_at`, `date_started`, `email`, `f_name`, `isms`, `l_name`, `location`, `m_number`, `modules_list`, `no_empl`, `password`, `updated_at`) VALUES (NULL, NULL, '2013-05-09 05:54:02', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2013-05-09 05:54:02')[0m
[1m[35m (42.6ms)[0m COMMIT
[1m[36m (0.1ms)[0m [1mBEGIN[0m
[1m[35m (0.1ms)[0m COMMIT
Redirected to companies/create
Completed 302 Found in 48ms (ActiveRecord: 43.2ms)
Connecting to database specified by database.yml
私のコントローラーコード:
class CompaniesController < ApplicationController
def new
@companies = Companies.new
end
def create
@companies = Companies.create(params[:id])
if @companies.save
redirect_to 'companies/create'
end
end
end
私のフォームの外観:
<%= form_for :companies, :url => {:action => "create"} , :method => "post" do |f| %>
Enter your Company Details :
<br />
<br />
<%= label_tag(:f_name, "First Name:") %>
<%= f.text_field(:f_name) %>
<br />
<br />
<%= label_tag(:l_name, "Last Name:") %>
<%= f.text_field(:l_name) %>
<br />
<br />
<%= label_tag(:email , "Email:") %>
<%= f.email_field(:email) %>
<br />
<br />
<%= label_tag(:password , "Password") %>
<%= f.password_field(:password) %>
<br />
<br />
<%= label_tag(:c_password , "Confirm Password") %>
<%= f.password_field(:c_password) %>
<br />
<br />
<%= label_tag(:c_name , "Company Name:") %>
<%= f.text_field(:c_name) %>
<br />
<br />
<%= label_tag(:location , "Location:") %>
<%= f.text_field(:location )%>
<br />
<br />
<%= label_tag(:m_number , "Mobile number") %>
<%= f.telephone_field(:m_number) %>
<br />
<br />
Do You have ISMS implemented ?
<%= f.radio_button(:isms , "Yes" )%>
<%= f.radio_button(:isms , "No") %>
<br />
<br />
<%= label_tag(:no_empl , "No of Employees") %>
<%= f.select(:no_empl ,options_for_select([['> 10',1],['< 10',2],['<100',3]])) %>
<br />
<br />
<%= label_tag(:date_started , "When do you start your organization:")%>
<%= f.date_select(:date_started) %>
<br />
<br />
<%= label_tag (:modules_list) %>
<%= f.select(:modules_list , options_for_select([['Audit Management',1],['Risk Management',2],['Policy Management',3]])) %>
<br />
<br />
<%= f.submit %>
<%end %>