Hopefully I can explain this well enough, but please let me know if more information is needed!

I'm building a form where a user can create an "incident". This incident has the following relationships:

  • belongs_to: customer (customer has_many incidents)
  • belongs_to: user (user has_many incidents)
  • has_one: incident_status (incident_status belongs to incident)

The form allows the user to assign the incident to a user (select form) and then select an incident status. The incident is nested in customer.

However, I'm getting the following in the server logs:

Processing IncidentsController#create (for 127.0.0.1 at 2010-04-26 10:41:33) [POST]
Parameters: {"commit"=>"Create", "action"=>"create", 
"authenticity_token"=>"YhW++vd/dnLoNV/DSl1DULcaWq/RwP7jvLOVx9jQblA=", 
"customer_id"=>"4", "controller"=>"incidents", "incident"=>{"title"=>"Some Bad Incident", 
"incident_status_id"=>"1", "user_id"=>"2", "other_name"=>"SS01-042310-001"}}

User Load (0.3ms)   SELECT * FROM "users" WHERE ("users"."id" = 2) LIMIT 1
Redirected to http://localhost:3000/session/new
Filter chain halted as [:login_required] rendered_or_redirected.
Completed in 55ms (DB: 0) | 302 Found [http://localhost/customers/4/incidents]

It looks to me like it's trying to gather information about the user, even though it already has the id (which is all it needs to create the incident), and the user may not have permission to do a select statement like that? I'm rather confused.

Here is the relevant (I think) information in the Incident controller.

before_filter :login_required, :get_customer

def new
  @incident = @customer.incidents.build
  @users = @customer.users
  @statuses = IncidentStatus.find(:all)

  respond_to do |format|
    format.html # new.html.erb
    format.xml  { render :xml => @incident }
  end
end

def create
  @incident = @customer.incidents.b
Edit
Report