wap
August 10, 2009, 4:34pm
1
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
August 10, 2009, 5:14pm
2
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
wap
August 10, 2009, 5:55pm
3
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
wap
August 11, 2009, 9:51am
4
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
wap
August 11, 2009, 11:05am
5
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
wap
August 11, 2009, 7:34am
6
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