2011-07-04 56 views

回答

1
<%= form_for(current_user, :remote => true) do |f| %> 
    <p> 
    <%= f.label :language, t("language") %>: 
    <%= f.select :language, options_for_select([["Русский", "rus"], ["English", "eng"]]) %> 
    </p> 

    <p><%= f.submit t "options.save" %></p> 
<% end %> 

注意变量到f.label, f.select and f.submit

的和变化在导轨form_for和对应form_buider对象(|f|)的下一个公共密钥,该导轨能理解用于组值。 *_tag助手通常用于传递无关的参数。

+0

'表格数据视图URL编码 UTF8:✓ _method:把 authenticity_token:epPcqZuTWLM4qwdgTXfbuuDLj64Pn2q2mzTWLB3AO2E = 用户%5Blanguage%5D:主机 承诺:Save' incorect:用户%5Blanguage%5D:主机 –

+0

你检查你的CURRENT_USER不是零? – rubish

+0

#<用户ID:1,电子邮件:“[email protected]”,encrypted_pa​​ssword:“$ 2a $ 10 $ vOfBA2WhLIXyhweD3bXZSeEqJ240UPh85muJ47jEnH.w ...”,reset_password_token:nil,reset_password_sent_at:nil,remember_created_at:nil,sign_in_count:14 ,current_sign_in_at:“2011-07-04 08:27:51”,last_sign_in_at:“2011-07-03 21:39:38”,current_sign_in_ip:“127.0.0.1”,last_sign_in_ip:“127.0.0.1”,created_at:“ 2011-07-04 15:43:04“,updated_at:”2011-07-04 08:27:51“,用户名:nil,password_salt:nil,password_hash:nil,avatar_url:nil,language:nil> –