Rails 请教个表单里怎么添加 css 样式的问题

lin_style · April 16, 2012 · Last by camel replied at April 16, 2012 · 3418 hits

旧的是这样:

用户名 (邮箱)

这时候加个表单: <%= form_for @user, :url => { :controller => 'users', :action => 'create', :id => @user } do |f| %>

  • <%= f.label :name, "用户名 (邮箱)" %> <%= f.text_field :name %>
  • 这个时候我的 class="txt-ctrl"要写在哪儿呢???

    :html => { :class => "edit_post", :id => "edit_post_45" }

    http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html

    :html => { :class => "txt-ctrl" }

    RTFD

    你那个:url 是默认的,可省

    You need to Sign in before reply, if you don't have an account, please Sign up first.