# Newbie REST confusion

**URL:** <https://www.ruby-forum.com/t/newbie-rest-confusion/142745>\
**Category:** Rails\
**Created:** [July 11, 2008, 1:10am UTC](https://www.ruby-forum.com/t/newbie-rest-confusion/142745 "2008-07-11T01:10:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paradise](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8e7dd6/32.png) [@paradise](https://www.ruby-forum.com/u/paradise)\
**Post date:** [July 11, 2008, 1:10am UTC](https://www.ruby-forum.com/t/newbie-rest-confusion/142745/1 "2008-07-11T01:10:23Z")

</div>

So I am trying to do the simple action of updating user  
information(the model is named spec) that may not exist in the first  
place. Meaning I have one view for both new and update. I think  
theres something wrong with my variables or something, not sure…but  
here is my code:

in the spec controller:  
def edit  
@title = ‘Edit User Information’  
@user = logged\_in\_user  
@user.spec ||= Spec.new  
@spec = @user.spec  
end

def update  
if @user.spec.update\_attributes(params[:spec])  
flash[:notice] = “Specs updated”  
redirect\_to user\_path(logged\_in\_user)  
end  
end

this is the edit view:  
\<% form\_for :spec, :url =\> spec\_url,  
:html =\> { :method =\> :put } do |form| %\>

 \<%= @title %\>

```
 <%= error_messages_for 'spec' %>
 <%= text_field_for form, "first_name" %>
 <%= submit_tag 'Create', :class => "submit" %>

```

 \<% end %\>

This is really confusing, but I dont think its a complicated problem.  
thanks.

---

<div class="post-metadata">

**Author:** ![paradise](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8e7dd6/32.png) [@paradise](https://www.ruby-forum.com/u/paradise)\
**Post date:** [July 11, 2008, 1:14am UTC](https://www.ruby-forum.com/t/newbie-rest-confusion/142745/2 "2008-07-11T01:14:29Z")

</div>

Hi –

On Thu, 10 Jul 2008, Dave L. wrote:

> @user = logged\_in\_user
> 
> this is the edit view:  
> \<% form\_for :spec, :url =\> spec\_url,  
> :html =\> { :method =\> :put } do |form| %\>
> 
> \<%= @title %\>
> 
> ```
> <%= error_messages_for 'spec' %>
> <%= text_field_for form, "first_name" %>
> 
> ```

Try changing that to: form.text\_field “first\_name”

David

–  
Rails training from David A. Black and Ruby Power and Light:  
Intro to Ruby on Rails July 21-24 Edison, NJ  
Advancing With Rails August 18-21 Edison, NJ  
See [http://www.rubypal.com](http://www.rubypal.com) for details and updates!
