| | |
Forms fields pre-populating w/ first record's values
Please support our Ruby advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Aug 2005
Posts: 7
Reputation:
Solved Threads: 0
I have a strange situation. I want to have a create_user form w/ all the fields blank
When I call the create_user method, the corresponding create_user.html.erb form is displaying the first
record's data from the user table in the form fields
Here's a quick view of my form:
When that form loads, it is populated w/ the First and last name from the first user record in the db.
Anyway around this - I've tried everything I can think of.
Thanks,
Clem
When I call the create_user method, the corresponding create_user.html.erb form is displaying the first
record's data from the user table in the form fields
Here's a quick view of my form:
Ruby Syntax (Toggle Plain Text)
<% form_tag('create_user') do -%> <%=hidden_field("user", "id") %> (<%=params[:id] %>) <p><label for="fname">First Name</label><br/> <%=text_field("user", "fname") %></p> <p><label for="lname">Last Name</label><br/> <%=text_field("user", "lname") %></p> <%=submit_tag("Create") %> <% end -%>
When that form loads, it is populated w/ the First and last name from the first user record in the db.
Anyway around this - I've tried everything I can think of.
Thanks,
Clem
In your controller do you have
or something similar? Could you post your controller code?
ruby Syntax (Toggle Plain Text)
@user = User.find(:first)
or something similar? Could you post your controller code?
Note to self... pocket cup
![]() |
Other Threads in the Ruby Forum
- Previous Thread: Need help to install rails on Ubuntu
- Next Thread: HABTM Question w/ checkboxes
| Thread Tools | Search this Thread |





