Link_to_remote

I have a link_to_remote that when clicked will put a form in a div and
there are three such links. The problem taht I having is that when this
form is placed with the div and the submit botton is hit, the method
gets called but as soon as the program reached the @user.save line
nothing happens. In other words, there is no reason why the user
submitte dinto should not be saved; I have done this hundreds of times
in this project, but for whatever reason, it will not save. Here is the
if statement that should be executed (in submit_delivery):

 if @user.save
    redirect_to :action => 'edit_traveler_form', :id => @user.id
  end

and here is the code that renders the form in the div (in set_delivery):

 render :partial => 'editor_for_home' , :delivery => 'home'

Here is the link_to_remote:

 <%= link_to_remote 'Home', :url => { :action => 'set_delivery', :id

=>
@user.id, :delivery => ‘home’ }, :update => ‘all’ %>

and finally, the form tag:

 <% form_tag :action => 'submit_delivery', :id => @user.id,

:delivery =>
params[:delivery] do -%>

Just wondering if the form isn’t working because it is a link_to_remote?
Thanks,

~S

Shandy N. wrote:

 if @user.save

Put on bang a: @user.save!

Then run it and look at your log?


Phlip
http://www.oreilly.com/catalog/9780596510657/
^ assert_xpath
http://tinyurl.com/yrc77g <-- assert_latest Model

Phlip wrote:

Shandy N. wrote:

 if @user.save

Put on bang a: @user.save!

Then run it and look at your log?


Phlip
http://www.oreilly.com/catalog/9780596510657/
^ assert_xpath
http://tinyurl.com/yrc77g <-- assert_latest Model

I try and do that and I get:

Validation failed: Password Password to short
(Must be 5 characters long)
, Password Password must be alphanumeric

The funny thing is, is that this is in a part of the form that’s not
dealing with the password. Now do have these lines of code in my user
controller:

validates_format_of :password, :with => /^\w+$/, :message => '<b style

“color:red”>Password must be alphanumeric’

validates_length_of :password, :minimum => 5, :message => ‘Password to short (Must be 5 characters long)

Not sure what’s going on?

Shandy N. wrote:

 if @user.save

What’s the line above this? How do you know @user is the same as the
@user in the form? (Recall that Rails effectively stopped and
restarted between sending a view and collecting its responding
actions.)

if your @user is not the same as the one indicated by params[:id],
then it has no password…


Phlip
http://www.oreilly.com/catalog/9780596510657/
^ assert_xpath
http://tinyurl.com/yrc77g <-- assert_latest Model

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs