Rails 3 提供了 match
方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:
注:(r3 代表 Rails 3,r4 代表 Rails 4)
# routes.rb
useradd nagios | |
mkdir -p /opt/install_file | |
cd /opt/install_file | |
scp 10.103.13.148:/opt/install_file/nagios-plugins-1.5.tar.gz /opt/install_file | |
scp 10.103.13.148:/opt/install_file/nrpe-2.15.tar.gz /opt/install_file | |
tar xvfz nagios-plugins-1.5.tar.gz | |
cd nagios-plugins-1.5 | |
./configure --prefix=/opt/nagios | |
make && make install | |
chown nagios.nagios /opt/nagios |
==> Installing dependencies for python: readline, sqlite, gdbm | |
==> Installing python dependency: readline | |
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.2.4.mavericks.bottle.2.tar.gz | |
######################################################################## 100.0% | |
==> Pouring readline-6.2.4.mavericks.bottle.2.tar.gz | |
==> Caveats | |
This formula is keg-only, so it was not symlinked into /usr/local. | |
OS X provides the BSD libedit library, which shadows libreadline. | |
In order to prevent conflicts when programs look for libreadline we are |
package |
290a4210ec26f55ddbf5dae952ad0c3c |
- certain endpoints are always blocked | |
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then | |
ngx.exit(403) | |
end | |
-- import requirements | |
local cjson = require "cjson" | |
-- setup some app-level vars | |
local app_id = "APP_ID" |
88770 |
[uwsgi] | |
socket = /data/app/run/%n.sock | |
pidfile2 = /data/app/run/%n.pid | |
logto2 = /data/app/logs/uwsgi.log | |
logdate = true | |
log-format = [%(addr)] [%(ctime)] [%(method)] [%(uri)] [%(proto)] [%(status)] [%(msecs)] [%(referer)] [%(uagent)] | |
memory-report = true |
when we use the plugin act_as_ferret,got the exception | |
EOFError in 'DestroysController save destroy require reason' | |
End-of-File Error occured at <except.c>:117 in xpop_context | |
Error occured in store.c:216 - is_refill | |
current pos = 0, file length = 0 | |
we should do this : | |
script/console test | |
>> MyModel.rebuild_index |
app/models/department_duties.rb | |
class DepartmentDuties < ActiveRecord::Base | |
include UuidHelper | |
index :id | |
belongs_to :department, :class_name => "Department" | |
#创建人,修改人 | |
belongs_to :creator, :class_name => "User" | |
belongs_to :modifier, :class_name => "User" | |
end |