-1

我创建了一条路线:

user_currency GET    /user/currency/:currency(.:format)        user#currency

这是我的用户控制器:

class UsersController < ApplicationController 
require 'will_paginate/array' 
require 'gdata'       
before_filter :ensure_user_friendly_url, :only => [:show, :following, :followers, :friends, :designers]
before_filter :check_if_signed_in, :only => :signup

以及路线的控制器:

def currency
session[:currency] = params[:currency]
redirect_to :back
end

我收到一个错误:

uninitialized constant UserController

错误发生在这里:

- currency_values.each do |currency|
    %li 
      = link_to "#{currency.country}", user_currency_url(currency.id)

currency_id作为货币传递。

4

1 回答 1

2

在您的路由声明中,您错误地引用了控制器名称。它应该是:

user_currency GET    /user/currency/:currency(.:format)        users#currency

基本上你的控制器UsersController不是UserController.

于 2013-07-18T05:38:12.363 回答