# Link\_to\_remote

**URL:** <https://www.ruby-forum.com/t/link-to-remote/112349>\
**Category:** Rails\
**Created:** [August 17, 2007, 7:44pm UTC](https://www.ruby-forum.com/t/link-to-remote/112349 "2007-08-17T19:44:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [August 17, 2007, 7:44pm UTC](https://www.ruby-forum.com/t/link-to-remote/112349/1 "2007-08-17T19:44:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [August 17, 2007, 8:06pm UTC](https://www.ruby-forum.com/t/link-to-remote/112349/2 "2007-08-17T20:06:25Z")

</div>

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/](http://www.oreilly.com/catalog/9780596510657/)  
^ assert\_xpath  
[O'Reilly Media - Technology and Business Training](http://tinyurl.com/yrc77g) ← assert\_latest Model

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [August 17, 2007, 8:41pm UTC](https://www.ruby-forum.com/t/link-to-remote/112349/3 "2007-08-17T20:41:57Z")

</div>

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/](http://www.oreilly.com/catalog/9780596510657/)  
> ^ assert\_xpath  
> [O'Reilly Media - Technology and Business Training](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?

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [August 17, 2007, 9:13pm UTC](https://www.ruby-forum.com/t/link-to-remote/112349/4 "2007-08-17T21:13:32Z")

</div>

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/](http://www.oreilly.com/catalog/9780596510657/)  
^ assert\_xpath  
[O'Reilly Media - Technology and Business Training](http://tinyurl.com/yrc77g) ← assert\_latest Model
