保存到数据库后,年份属性为零-不从表单传输

时间:2018-10-04 02:39:51

标签: ruby-on-rails

“我的年份”属性未从表单下拉菜单转移。我不确定我要去哪里。

我的表单:

public interface IEnemy
{
     StateMachine m_FSM { get ; }
}

public abstract class EnemyBase<TState, TTransition> : IEnemy
{

    protected StateMachine<TState, TTransition> m_FSM;
    StateMachine IEnemy.m_FSM => this.m_FSM;
}

public class StateMachine
{

}

public class StateMachine<TState, TTransition> : StateMachine
{

}

控制器代码:

  <%= simple_form_for @movie do |f| %>

    <div class="form-group">
      <%= f.input :title, placeholder: "Movie Title", input_html: { class: 'form-control' } %>
    </div>

    <div class="form-row">
      <div class="form-group col-md-6">
        <%= f.input :year, as: :date,
            start_year: Date.today.year,
            end_year: Date.today.year - 100, 
            discard_day: true, order: [:year], 
            input_html: { class: 'form-control' } %>
      </div>

它在视图中看起来和正常工作,但是当我检查数据库时,年份为零。有什么想法吗?

0 个答案:

没有答案