Insert record in table error

i have cateadd.html.erb file in admins folder and i want call admins
controller and define method like this

       def cateadd
@pro_categorie = ProCategorie.new
respond_to do |formate|
format.html # new.html.erb
           format.xml  { render :xml => @pro_categorie }
         end

end

pro_categories is table name i want to insert record in this table
but bad luck i can not do it

Wap A. wrote:

i have cateadd.html.erb file in admins folder and i want call admins
controller and define method like this

       def cateadd
@pro_categorie = ProCategorie.new
respond_to do |formate|
format.html # new.html.erb
           format.xml  { render :xml => @pro_categorie }
         end

end

pro_categories is table name i want to insert record in this table
but bad luck i can not do it

I believe rails pluralization rules may be getting confused here… try
renaming your model to “ProCategory” or add:

class ProCategorie
set_table_name “pro_categories”
end

hth
ilan

On Aug 10, 3:34 pm, Wap A. [email protected]
wrote:

i have cateadd.html.erb file in admins folder and i want call admins
controller and define method like this

       def cateadd
@pro_categorie = ProCategorie.new
respond_to do |formate|
format.html # new.html.erb
           format.xml  { render :xml => @pro_categorie }
         end

You’ve got a typo here - formate/format

Fred

On Aug 11, 6:34 am, Wap A. [email protected]
wrote:

<% form_for(@pro_categorie) do |f| %>

Have you added map.resources :pro_categories in your routes.rb file ?
THat’s the price you must pay to be able to use this short form. If
you have then the most likely reason is rails getting confused about
the pluralization

Fred

Frederick C. wrote:

On Aug 11, 6:34�am, Wap A. [email protected]
wrote:

� �<% form_for(@pro_categorie) do |f| %>

Have you added map.resources :pro_categories in your routes.rb file ?
THat’s the price you must pay to be able to use this short form. If
you have then the most likely reason is rails getting confused about
the pluralization

Fred

thanks for give me right direction

Frederick C. wrote:

On Aug 10, 3:34�pm, Wap A. [email protected]
wrote:

i have cateadd.html.erb file in admins folder and i want call admins
controller and define method like this

� � � � � �def cateadd
� � @pro_categorie = ProCategorie.new
� � respond_to do |formate|
� � format.html # new.html.erb
� � � � � � � �format.xml �{ render :xml => @pro_categorie }
� � � � � � �end

You’ve got a typo here - formate/format

Fred

thanks dear is it ok but when put on @pro_categorie in cateadd.html.erb
is below

Add product category

<% form_for(@pro_categorie) do |f| %>
<%= f.error_messages %>

Category Name : <%= f.text_field :pcate_name %>
Category Description : <%= f.text_field :pcate_desc %>
<%end%>

i got error
Showing app/views/admins/cateadd.html.erb where line #5 raised:

undefined method `pro_categories_path’ for #ActionView::Base:0x4839358

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs