我已经包含了inflections.rb
$('.form-control').keyup(function () {
var name = $('#member_search').val();
var phone = $('#member_contact').val();
var father = $('#member_father').val();
if (name || phone || father) {//use name && phone && father if you want to make sure all inputs has content
$.ajax({
type: "post",
url: "search_result.php",
data: {
name: name,
contact: phone,
father: father
},
success: function (data) {
$('#result').html(data);
}
});
} else {
$('#result').html('');
}
});
和我的控制器leaves_controller.rb
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.irregular 'leaves', 'leaves'
end
in leaves / new.html.erb
class LeavesController < ApplicationController
def new
@leave = Leave.new
end
def create
@leave = Leave.create(leave_params)
if @leave.errors.present?
render :action => :new
else
redirect_to root_path, notice: I18n.t('leave_applied')
end
end
private
def leave_params
params.require(:leave).permit(:start_date,:end_date)
end
end
所以当我去离开/新路径时,它给了我这个错误:
<%= form_for @leave do |f| %>
<%= f.text_field :start_date, :placeholder => 'From Date',
:class => 'datepicker' %>
<%= f.text_field :end_date, :placeholder => 'To Date',
:class => 'datepicker' %>
<%= f.submit%>
<% end %>
请指导我如何解决这个问题。
答案 0 :(得分:2)
问题是:当它尝试根据您的新变形器渲染leaves/new
时,Leaves
搜索ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.irregular 'leave', 'leaves'
end
常量。
将其更改为
getVideoStatus