Question

I have this in my database

<input type="text" value="<%= account["accountname"] %>"/>

this will show the value of accountname in the field that I desire it too.

However, if I want the user to change that value to something else it doesn't allow that to occur.

If I put this in place of the above code sample

<%= text_field_tag :accountname, params[:accoutname] %>

This allows me to change the value and updates the database. However, the field stays blank in the views to the user.

I am wondering if there is a way for me to be able to change the database as well as display the accountname in the views

Was it helpful?

Solution 2

<input type="text" name= "accountname" value="<%= account["accountname"] %>"/>

I needed to add the name field to do what I wanted.

OTHER TIPS

Did you cut-and-paste this code? If so, you have a typo.

params[:accoutname]

:accountname

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top