Strange 500 Internal Server Error Related

Well, I've been trying to fix this all day, and I've come up empty. It
seems that, for some mysterious reason, my app now doesn't like to
register new users, at least in my development environment. I sent my
code to my friend (who should be running in the same environment I am,
since I helped him set his up), and he doesn't get any errors
registering users. I've tried reinstalling Rails, but that didn't fix
it. I reinstalled Rails and all its dependencies, but that didn't fix
it. I tried reinstalling Ruby, RubyGems, Rails, and dependencies, but I
STILL get the same 500 Internal Server Error. I've gone through all of
my code, and it seems like this isn't because of something I wrote.
Here's what shows up in the log file:

Rendering
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/templates/rescues/layout.erb
(not_found)
/!\ FAILSAFE /!\ Sun Jun 08 17:05:19 -0400 2008
  Status: 500 Internal Server Error
  Conflicting types for parameter containers. Expected an instance of
Array but found an instance of Hash. This can be caused by colliding
Array and Hash parameters like qs[]=value&qs[key]=value. (The parameters
received were {"ruler"=>"", "nation_name"=>"", "password"=>"",
"email"=>""}.)

After that is the trace, which shows no references to any files I've
written or modified. Has anyone experienced anything like this before,
or have any ideas on how to fix this? Any help would be GREATLY
appreciated :slight_smile:

Rendering
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/templ ates/rescues/layout.erb
(not_found)
/!\ FAILSAFE /!\ Sun Jun 08 17:05:19 -0400 2008
Status: 500 Internal Server Error
Conflicting types for parameter containers. Expected an instance of
Array but found an instance of Hash. This can be caused by colliding
Array and Hash parameters like qs[]=value&qs[key]=value. (The parameters
received were {"ruler"=>"", "nation_name"=>"", "password"=>"",
"email"=>""}.)

The interesting bit is going to be the data posted to your app (and by
extension the form that the user fills in.

Fred

The interesting bit is going to be the data posted to your app (and by
extension the form that the user fills in.

Fred

The data that should be being sent is simple registration stuff, user
name, a second user name (it makes sense within my app), email,
password, password confirmation, and acceptance of the TOS. The error
message suggests that it does something (or rather, tries to do
something) with this, once submit is pressed (I used blank values for
all fields when getting the error from the log file. It will show the
values in the error message if I enter them, but will still cause an
error even if the information is valid and should be accepted).

The code for my registration form:

<% form_for :user do |form|%>
  <fieldset>
    <legend>Enter Your Details</legend>

    <%= error_messages_for "user"%>
    <%= render :partial=>"nation_name_field_row",
:locals=>{:form=>form}%>

    <%= render :partial=>"ruler_field_row", :locals=>{:form=>form}%>

    <%= render :partial=>"email_field_row", :locals=>{:form=>form}%>

    <%= render :partial=>"password_field_row", :locals=>{:form=>form,
:field=>"password"}%>

    <%= render :partial=>"password_field_row", :locals=>{:form=>form,
:field_title=>"Confirm"}%>

    <div class="form_row">
      <label for="tos">&nbsp</label>
      <%= render :partial => "tos", :locals =>{:form => form}%>
      <br/>
    </div>

    <div class="form_row">
      <%= submit_tag "Register!", :class=>"submit"%>
    </div>
  </fieldset>
<% end %>

The nation_name_field_row partial:

<div class="form_row">
  <label for="nation_name">Nation Name:</label>
<%= form.text_field :nation_name, :size=>User::NAMES_MAX_LENGTH,
:maxlength=>User::NAMES_MAX_LENGTH%>
</div>

The ruler_field_row partial:

<div class="form_row">
  <label for="ruler">Ruler:</label>
<%= form.text_field :ruler, :size=>User::NAMES_MAX_LENGTH,
:maxlength=>User::NAMES_MAX_LENGTH%>
</div>

The email_field_row partial:

<div class="form_row">
<label for="email">Email:</label>
<%= form.text_field :email, :size=>User::EMAIL_MAX_LENGTH,
:maxlength=>User::EMAIL_MAX_LENGTH%>
</div>

And finally, the password field row partial:

<% field_title = nil if not defined?(field_title)%>
<div class="form_row">
  <label for="<%= field %>">
         <%= field_title || field.humanize%>
         </label>
  <%= form.password_field field, :size=>User::PASSWORD_MAX_LENGTH,
:maxlength=>User::PASSWORD_MAX_LENGTH%>
</div>

I should point out that most of these partials are used in other places
in the application (the login page), and they don't cause this same
error there.

If needed, I can post the code in my controller too, but puts statements
suggest that it doesn't even try to execute.

By the lack of responses since Fred's initial one, I'm guessing this
isn't the easiest of things to solve.

My question then becomes, should I be fine continuing to work in the
same environment, or am I most likely going to run into more strange
errors like this one?

The html generated would be helpful too. Random guess: your password partial is confusing things because you appear to be using the same name for the field.

Other than that, use the standard approach: remove stuff from your form until it works, i.e. isolate the culprit

Fred

I'll post the HTML when I get home tonight. However, I'm fairly
positive its nothing to do with the partials. The same setup has worked
fine in other apps I've built (although its quite possible I've made a
small mistake somewhere, which I'll check for). The exact code I'm
using runs fine for another, so unless he's wrong about that (which is
possible, since he's quite new to Rails), then it can't be anything
weird with code I've written.

I also reverted the view (and other relevant code) back to a version
when it was working without any problems, and still managed the same
error.

I'll try it again tonight to make sure, and post back the results :slight_smile:

Well, this turned out to be a completely stupid error on my part. I
have no idea how my friend managed to run it. I looked at the html, and
saw some blank spots for label names and stuff, which seemed odd. I
looked at my register.html.erb again, and it turned out that I wasn't
passing a field variable to the partial for password confirmation.
Adding that in fixed the problem.

Thanks very much for your help Fred (I honestly would've never thought
to check the HTML without you) :slight_smile: