Hey all,

I installed the devise plugin and I'm sure it's fully installed.

I have a popup where user creates an account, including email, password,
and password confirmation. When they click submit, I use jquery's .ajax
method:


          $.ajax({
              url: $('#dialog-form form:first').attr('action'),
              method: 'POST',
              data: $('#dialog-form form:first').serialize(),

              beforeSend: function(data){
                  $('#headerHome').html('Loading...');
                },
              success: function() { alert("success"); },
              failure: function() { alert("failure"); }
            });


That action attribute I inspect with firebug, and it's pointing to this
link:

/users

Although in the partial, I specify /users/create:

<%= form_for :user, :url => { :controller => "users", :action =>
"create" } do |f| %>
  <%= f.label :email, 'Email' %>:
  <%= f.text_field :email, :id => "email"  %><br />
  <%= f.label :password, 'password' %>:
  <%= f.password_field :password, :id => "password" %><br />
  <%= f.label :password_confirmation, 'password_confirmation' %>:
  <%= f.password_field :password_confirmation %><br />
<% end %>

The create method of my user's controller contains this:

 def create
    @user = User.new(params[:user])

    if @user.save
      respond_to do |format|
        format.json { render :json => @user.to_json, :status => 200 }
        format.xml  { head :ok }
        format.html { redirect_to :action => :index }
      end
    else
      respond_to do |format|
        format.json { render :text => "Could not create user", :status
=> :unprocessable_entity } # placeholder
        format.xml  { head :ok }
        format.html { render :action => :new, :status =>
:unprocessable_entity }
      end
    end
  end


Basically, all that happens when I click submit is a piece of html
renders on page "loading..." courtesy of the beforeSend callback
function. But it just hangs there. The success is never called and the
record is never written to the database.

I'm not sure what the problem could be.

Thanks for response.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to