Hello! On my site, the user can watch his profile. In his profile he can have a look at his data (i.e. signature). Now I want my users being able to edit this data while watching it. So I coded the following in my view:
<div id="profile-signature">
<p>
<b>Signature:</b>
<%=h @user.signature %>
</p>
<%= form_remote_tag(:update => "signature",:url => { :action => :update_signature }) %>
<%= text_area(:signature,:class=>"form-textarea") %>
<%= submit_tag "Save Signature" %>
</div>
in my user controller, I created a new action update_signature
def update_signature
puts 'in function!'
@user = current_user
puts @user.login
puts params[:signature]
@user.signature = params[:signature]
@user.save
puts 'saved'
end
Now, submitting the form, puts params[:signature] will output: classform-textareasfsffsfs where sfsffsfs is the text I entered. Reloading and my page and output the signature on page (<%=h @user.signature %>), I get: "--- !map:HashWithIndifferentAccess classform-textarea: sfsffsfs "
Why do I get this strange string instead of just sfsffsfs (in this case)? What to do, to update the data (<%=h @user.signature %>) automatic without page reload?