mardi 7 avril 2015

Getting Load error in Ruby on Rails 3

Hi i am getting the following error when making one form using Rails3.


Error:



LoadError in SdfsController#edit

Expected C:/Site/swargadwar_admin/app/models/t_sdf.rb to define T_sdf
Rails.root: C:/Site/swargadwar_admin

Application Trace | Framework Trace | Full Trace
app/controllers/sdfs_controller.rb:6:in `edit'


I am explaining my code below ,Please check these and let me to know how it will be resolved.


model/t_sdf.rb



class TSdf < ActiveRecord::Base
attr_accessible :Brahmin, :Created_By, :Date_Of_Death, :Deceased_Address1, :Deceased_Address2, :Deceased_Block, :Deceased_Country, :Deceased_Dist, :Deceased_Name, :Deceased_PS, :Deceased_State, :Deceased_Village, :Donation_Amount, :Donation_Date, :Doner_Address1, :Doner_Address2, :Doner_Block, :Doner_Country, :Doner_Dist, :Doner_MobileNo, :Doner_Name, :Doner_PS, :Doner_Photo, :Doner_Relationship_ID, :Doner_Relationship_Other, :Doner_State, :Doner_Thumb, :Doner_Video, :Doner_Village, :HCSY_Status, :Photo, :Updated_By, :receipt_no
end


controller/sdfs_controller.rb



class SdfsController < ApplicationController
def new

end
def edit
@sdf=T_sdf.new
end
def create
@sdf=T_sdf.new(params[:sdf])
if @sdf.save
flash[:notice]="Data saved successfully"
flash[:color]="valid"
redirect_to :action => 'new', :controller => "admins"
else
flash[:alert]="Data could not saved"
flash[:color]="invalid"
render 'edit'
end
end
end


views/sdfs/edit.html.erb



<center>
<%= form_for :sdf,:url => {:action => "create" } do |f| %>
<p>
<label for= "name">Deceased Name</label>
<%= f.text_field :Deceased_Name %>
</p>
<p>
<label for ="name">Deceased Address-1</label>
<%= f.text_field :Deceased_Address1 %>
</p>
<p>
<label for "name">Deceased Address-2</label>
<%= f.text_field :Deceased_Address2 %>
</p>
<p>
<label for ="name">Deceased Village</label>
<%= f.text_field :Deceased_Village %>
</p>
<p>
<label for= "name">Deceased Block</label>
<%= f.text_field :Deceased_Block %>
</p>
<p>
<label for ="name">Deceased Dist</label>
<%= f.text_field :Deceased_Dist %>
</p>
<p>
<label for ="name">Deceased State</label>
<%= f.text_field :Deceased_State %>
</p>
<p>
<label for ="name">Deceased country</label>
<%= f.text_field :Deceased_Country %>
</p>
<p>
<label for= "name">Deceased PS</label>
<%= f.text_field :Deceased_PS %>
</p>
<p>
<label for ="name">Date of Death</label>
<%= f.text_field :Date_Of_Death,:id => "popupDatepicker" %>
</p>
<p>
<label for ="name">Doner Name</label>
<%= f.text_field :Doner_Name %>
</p>
<p>
<label for= "name">Doner mobile no</label>
<%= f.telephone_field :Doner_MobileNo %>
</p>
<p>
<label for ="name">Doner relationship id</label>
<%= f.text_field :Doner_Relationship_ID %>
</p>
<p>
<label for ="name">Other relation ship id</label>
<%= f.text_field :Doner_Relationship_Other %>
</p>
<p>
<label for ="name">Doner Address-1</label>
<%= f.text_field :Doner_Address1 %>
</p>
<p>
<label for= "name">Doner Address-2</label>
<%= f.text_field :Doner_Address2 %>
</p>
<p>
<label for= "name">Doner Village</label>
<%= f.text_field :Doner_Village %>
</p>
<p>
<label for= "name">Doner Block</label>
<%= f.text_field :Doner_Block %>
</p>
<p>
<label for ="name">Doner Dist</label>
<%= f.text_field :Doner_Dist %>
</p>
<p>
<label for ="name">Doner State</label>
<%= f.text_field :Doner_State %>
</p>
<p>
<label for= "name">Doner Country</label>
<%= f.text_field :Doner_Country %>
</p>
<p>
<label for= "name">Doner PS</label>
<%= f.text_field :Doner_PS %>
</p>
<p>
<label for ="name">Donation Amount</label>
<%= f.text_field :Donation_Amount %>
</p>
<p>
<label for ="name">Donation date</label>
<%= f.date_field :Donation_Date %>
</p>
<p>
<label for= "name">Photo</label>
<%= f.file_field :Photo %>
</p>
<p>
<label for ="name">Doner photo</label>
<%= f.date_field :Doner_Photo %>
</p>
<p>
<label for="name">Bramhin</label>
<%= f.date_field :Brahmin %>
</p>
<p>
<label for= "name">Created</label>
<%= f.number_field :Created_By %>
</p>
<p>
<label for ="name">Updated</label>
<%= f.number_field :Updated_By %>
</p>
<p>
<label for ="name">HCSY Status</label>
Yes:<%= f.radio_button :HCSY_Status,'Yes',:checked => true %>
No: <%= f.radio_button :HCSY_Status,'No' %>
</p>
<p>
<%= f.submit "Submit" %>
</p>
<% end %>
</center>


Please help me to resolve this error.


Aucun commentaire:

Enregistrer un commentaire