标签:
控制器
class CourseSurveysController < ResourcesBaseController end
controller_name # "course_surveys" controller_name.singularize # "course_survey" controller_name.singularize.classify # "CourseSurvey"
‘Module‘.constantize # => Module(没"",不是字符串) ‘Test::Unit‘.constantize # => Test::Unit(没"",不是字符串)
class Person < ActiveModel::Model end Person.model_name # => Person Person.model_name.class # => ActiveModel::Name Person.model_name.singular # => "person" Person.model_name.plural # => "people"
controller_name classify constantize model_name
标签:
原文地址:http://www.cnblogs.com/tardis/p/4272340.html