2013-08-02 45 views

回答

0

任何活性的支架結構中,可以使用的before_filter(或before_action在導軌4):

DEFAULT_LENGTH = 30 
before_filter :set_list_length 

def set_list_length 
    length = @current_user.settings.per_page || DEFAULT_LENGTH 
    active_scaffold_config.list.per_page 
    # you can set here almost anything you want from AS config using active_scaffold_config and @current_user 
end 
相關問題