This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#in model user.rb | |
class User < ActiveRecord::Base | |
has_one :addresses | |
end | |
#in model address.rb | |
class Address < ActiveRecod::Base | |
blongs_to :user | |
end | |
#in controller users_controller.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
首先我们来生成公钥文件。Terminal下面输入 | |
ssh-keygen -t rsa | |
之后在Terminal的提示里按回车。直到生成id_rsa.pub文件,生成的id_rsa.pub文件在 ~/.ssh下面。Terminal下面输入 | |
cd ~/.ssh | |
cp id_rsa.pub authorized_keys | |
上面第一句的意思是进入~/.ssh文件夹,第二句是复制id_rsa.pub为authorized_keys文件。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read_dir() { | |
for item in $(ls $1) | |
do | |
if [ -d $1"/"$item ];then | |
read_dir $1"/"$item | |
else | |
file=$1"/"$item | |
suffix=${file##*.} |