Dear all Now i am a group member with you. I am trying to built a application with Ruby on Rails. Now i am facing some problems. I have created a table named regions. The primary key is region_id (not default id). when i insert data from view data has inserted but not displayed. My new.html code is: <h1>New region</h1> <% form_for(@region) do |f| %> <%= f.error_messages %> <p> <%= f.label :region_type %><br /> <%= f.text_field :region_type %> </p> <p> <%= f.label :region_name %><br /> <%= f.text_field :region_name %> </p> <p> <%= f.label :region_country %><br /> <%= f.text_field :region_country %> </p> <p> <%= f.label :region_parent %><br /> <%= f.text_field :region_parent %> </p> <p> <%= f.submit 'Create' %> </p> <% end %> <%= link_to 'Back', regions_path %> after submitting the page shows a error: ActiveRecord::RecordNotFound in RegionsController#showCouldn't find Region without an ID RequestParameters: {"id"=>"0"}but there is no field named id in my database table. the show method in my regions_controller file is: def show @region = Region.find(params[:region_id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @region } end end i have generated the files using scaffold. please give me the solution. i don't know from where id is passing as a parameter. from a new member mujahid |
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails Bangladesh" group.
To post to this group, send email to rubyonrails...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails_bangl...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails_bangladesh?hl=en.
Dear Mr. Sohan Thank you for your reply. But region_id is created by a trigger. The region_id is for Division, District and PS. Division ID start from: 1000000, District ID start from: 1100000 and PS ID start from:1110000. so i don't know from where id is passing as a parameter. if it default how can i change it? please help me. thank you --- On Wed, 27/1/10, S. M. Sohan <soh...@gmail.com> wrote: |
class Region < ActiveRecord::Base
set_primary_key :region_id ... end
Dear Mr. Ashrafuzzaman Thank you toooo much. problem solved within 30 seconds!!!. mujahid --- On Wed, 27/1/10, Ashrafuzzaman <ashrafuz...@gmail.com> wrote: |