为什么变量不适用于此?

时间:2013-01-10 11:21:37

标签: ruby-on-rails ruby-on-rails-3

分页的变量@number_of_shop_records_to_display不起作用!
但如果我只用1替换它,它就可以了 为什么呢?

before_filter :set_variable

def set_variable
    @number_of_shop_records_to_display = 10
    @number_of_shop_tags_to_display = 20
end

def index
    ....
    @search = Shop.search do  
        fulltext params[:search]
        paginate :page => params[:page], :per_page => @number_of_shop_records_to_display
    end

    @shops = @search.results
    ....
end 

0 个答案:

没有答案