rails 中简单的创建保存一条信息

Securitylog.new(
#        :session => session.session_id,
        :session => request.session_options[:id],
        :user =>user.id,
        :user_name =>user.login,
        :terminal_ip =>request.remote_ip,
        :host_name =>request.env["HTTP_HOST"],
        :security_cause =>"成功登入.",
        :security_action =>params[:controller]+'/'+params[:action],
        :result => '成功',
        :details =>"操作成功").save

 创建一个securitylog的记录,这种new 后直接save的方法简单也很好用

你可能感兴趣的:(Security,Rails)