こんにちは、Ruby on Rails 4 のルートに問題があります
エラー:
undefined method `routes_path'
意見:
<h1>Load data</h1>
<div class="row">
<div class="span6 offset3">
`<%= form_for @route, :html => { :multipart => true } do %>
<%= hidden_field_tag 'current_user', @current_user %>
<%= file_field_tag :file %>
<%= submit_tag "Import", style: 'margin-top: -10px', class: "btn btn-primary" %>
<% end %>
コントローラ:
def new
@route = current_user.build_route
end
def create
nil_flag = Route.import(params[:file], current_user)
if nil_flag == 1
flash[:success] = "Data created."
redirect_to route_path(current_user)
else
flash[:error] = "Error"
redirect_to load_data_path
end
end
モデル:
def self.import(file, current_user)
@user = current_user
@route = @user.build_route
@nil_flag = 0
File.open(file.path, 'r') do |f|
.
.
.
#etc
end
ルート
'/load_data' に一致: 'routes#new'、経由: 'get'
ビュー、コントローラー、モデルの名前は「Route」
ビュー内のルートに問題がありますか? ありがとうございました