I need a migration to add column of type enum in rails 3. I will be using enumerated_attribute gem.
I generated a migration to add the column:
rails generate migration addUsage_reports_accessToClientParam usage_reports_access:enum
Now I need to set up the values for the enum and set the default value. Here is the generated migration:
class AddUsageReportsAccessToClientParam < ActiveRecord::Migration
def self.up
add_column :client_params, :usage_reports_access, :enum
end
def self.down
remove_column :client_params, :usage_reports_access
end
end
Thanks
答案 0 :(得分:1)
我找到了解决方案。这有效:
protected override void OnAuthorization(AuthorizationContext filterContext)
{
if(!User.IsInRole("Admin")
{
base.OnAuthorization(filterContext);
filterContext.RequestContext.HttpContext.Response.Redirect("/Login", true);
}
}