Form_for help needed

here is the scenario:

i have a form ( with couple of simple validations ) for the new action:

<% form_for :classified, @classified, :url=>{
:controller=>‘classifieds’, :action=>‘create’}, :html => { :multipart =>
true } do |f| %>
<%= error_messages_for ‘classified’ %>

<%= submit_tag ‘Post’ %>
<% end %>

when I click submit button without entering anything, it triggers
validation and comes back with necessary error messages on all browsers.
The view source html on firefox, ie displays

However, in google chrome, it shows an exception saying that index
action not found – here it is.

Unknown action

No action responded to index. Actions: create, delete, edit, new, show, simple_captcha_valid?, and update

IE and firefox do not show this error.

Am I doing anything wrong? or is it a Chrome issue?

Any help is much appreciated.

I tried this again with scaffold. When the validation is triggered,
Chrome executes index action at the background (right click your browser
and view source).

I guess, we have to assume that the http verb being used by chrome
appear to be ‘GET’ rather than ‘POST’.

Has anyone encountered similar issue?. How did you resolve this?. If
not, can it be ignored?

To reproduce, do the following

  1. create table ‘mytable’ with just one column ( ex: name )
  2. use scaffold – script/generate scaffold mytable name:string
  3. insert a validation in mytable model – validates_presence_of :name

Now, using chrome browser, try to insert a new ‘blank’ record. This
will trigger your model validation. Now right click and view source.

<% form_for :classified, @classified, :url=>{
in this not both required remove @classified and try to run it

Wap A. wrote:

<% form_for :classified, @classified, :url=>{
in this not both required remove @classified and try to run it

No change even after trying with

<% form_for(@classified, :html => { :multipart => true }) do |f| %>

Wap A., thanks for your suggestions. But they are not working. Are
they working for you?. Did you try it in Chrome for this or any of your
rails app?

<% form_for :classified, :url=>{
:controller=>‘classifieds’, :action=>‘create’}, :html => { :multipart =>
true } do |f| %>
<%= error_messages_for ‘classified’ %>

<%= submit_tag ‘Post’ %>
<% end %>

write like this no for <% form_for(@classified, :html => { :multipart =>
true }) do |f| %> this

in ur case there are two parameter :classified,@classified required only
1 :classified/@classified

On Wed, 2009-08-12 at 07:00 +0200, Rails L. wrote:

I guess, we have to assume that the http verb being used by chrome
appear to be ‘GET’ rather than ‘POST’.

You shouldn’t have to assume anything. I haven’t used Chrome but it’s
difficult to believe that there aren’t tools equivalent to Firebug, Live
Http Headers, etc. to assist developers targeting that platform. If
there aren’t, then I personally wouldn’t waste time developing for it.
At a minimum, using Mongrel as your server, your log file will tell you
the http verbs being used for each request.

HTH,
Bill

On Wed, Aug 12, 2009 at 9:59 AM, bill walton[email protected]
wrote:

I haven’t used Chrome but it’s
difficult to believe that there aren’t tools equivalent to Firebug, Live
Http Headers, etc. to assist developers targeting that platform. If
there aren’t

The nightly PPA Chrome builds do provide some fairly decent developer
tools.

Page Button → Developer → Developer Tools.


Greg D.
http://destiney.com/