index page shown to have been accessed in logs after resource creation BUT the new entry page persists.

Hi, guys

   I have just added a new functionality and attribute to my app.

Basically the main resource, 'part' has been linked with category and
sub category objects.

When creating a new 'part' object, the entry form now has two drop
down boxes, category and sub category.

I put in all the required attributes and hit "Save".

'parts/create' is then run (parts controller's 'create' method).
Based on my controller code, after the object has been successfully
added into the database, a redirection is to be
made to the index page of the 'parts' resource (ie. '/parts').

Here's how the log looks like.

----- extract starts ---------------------------

Started POST "/parts" for at 2012-01-09 21:53:27 +1100
  Processing by PartsController#create as JS
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"9P8ga/
n38K58buSAIqTh4XeZ8f3lVYBrjUEx4n7L5is=", "part"=>{"category_id"=>"2",
"sub_category_id"=>"11", "title"=>"s2000",
"description"=>"dmkdmldml"}, "commit"=>"Create Part"}
  User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id"
= 2 LIMIT 1
  SQL (10.4ms) INSERT INTO "parts" ("brand_id", "category_id",
"created_at", "created_by", "description", "sub_category_id", "title",
"updated_at", "updated_by") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
[["brand_id", nil], ["category_id", 2], ["created_at", Mon, 09 Jan
2012 10:53:27 UTC +00:00], ["created_by", 2], ["description",
"dmkdmldml"], ["sub_category_id", 11], ["title", "s2000"],
["updated_at", Mon, 09 Jan 2012 10:53:27 UTC +00:00], ["updated_by",
Redirected to http://localhost:3000/parts
Completed 302 Found in 83ms

Started GET "/parts" for at 2012-01-09 21:53:27 +1100
  Processing by PartsController#index as HTML
  User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id"
= 2 LIMIT 1
  Part Load (0.1ms) SELECT "parts".* FROM "parts"
Rendered parts/index.html.erb within layouts/application (69.3ms)
Completed 200 OK in 138ms (Views: 72.5ms | ActiveRecord: 2.6ms)

----- extract ends ----------------------------

The weird thing here is that whilst "/parts" is accessed as soon as
the insertion is successful and all parts objects are retrieved,
in my web interface, the entry form still persists.

What could be wrong?
what should I be checking?

Thank you

Gordon :slight_smile:

Here's what my parts_controller's create method looks like:

  # POST /parts
  # POST /parts.xml
  def create
    # Record current user's id as he/she created the part
    params[:part][:created_by] =
    params[:part][:updated_by] =

    @part =[:part])

        flash[:notice] = 'Part was successfully created.'
        redirect_to( :action => 'index' )
        format.html { render :action => "new" }

don't worry. Figured it out.
I had ' data-remote="true" ' in my form which makes any request to my
controller an ajax call (hence 'as JS' is being spotted each time a
controller method is called).