1. let's start to console without --sandbox param to create some record into our database:
rails console User.create!(:name => "china zhang", :email => "china@china.com")
to see if this work, let's use SQLite database browser to see.
2. let's create a view named
show.html.erb
then create a action in users_controller.rb
def show @user = User.find(params[:id]) end
we need to explain sth here,
params is a hash for controller to use:
params[:controller]
params[:action]
params[:id]
debug(params)
is a very useful method, ti will provide useful feedback, and it is very good habit to use it when you have some unexpected things happened.
3. we still need route to make things work. we will follow REST architecture.
resources :users
then you will get this route: users/1
4. it is a good timing to git commit your changes:
git add .
git commit -m "finished first half of the user model"
发表评论
-
12.3.3 scaling issue of the status feed
2011-10-30 17:54 831the problem of the implementati ... -
12.3 the status feed
2011-10-30 15:34 8681. we need to get all the micro ... -
12.2 a working follow button with Ajax
2011-10-29 18:10 9211. in the last chapter, in the ... -
12.2 a web interface for following and followers.
2011-10-28 22:14 8911.before we do the UI, we need ... -
12. following user, 12.1 relationship model
2011-10-18 14:29 7611. we need to use a relationshi ... -
11.3 manipulating microposts.
2011-10-17 15:31 9091. since all micropost actions ... -
11.2 show microposts.
2011-10-17 12:01 7121. add test to test the new use ... -
11.1 user micropost -- a micropost model.
2011-10-17 10:43 11181. we will first generate a mic ... -
10.4 destroying users.
2011-10-16 15:47 756in this chapter, we will add de ... -
10.3 showing users list
2011-10-15 20:41 785in this chapter, we will do use ... -
10.2 protect pages.
2011-10-15 15:11 678again, we will start from TD ... -
10.1 updating users.
2011-10-14 18:30 7171. git checkout -b updating-use ... -
9.4 sign out
2011-10-13 15:21 744whew!!!, last chapter is a long ... -
9.3 sign in success.
2011-10-12 15:39 7601. we will first finish the cre ... -
9.1 about flash.now[:error] vs flash[:error]
2011-10-12 15:37 737There’s a subtle difference ... -
9.2 sign in failure
2011-10-12 12:19 671start from TDD!!! 1. requir ... -
9.1 sessions
2011-10-12 10:00 650a session is a semi-permanent c ... -
what test framework should you use?
2011-10-11 16:56 0for integration test, i have no ... -
what test framework should you use?
2011-10-11 16:56 0<p>for integration test, ... -
8.4 rspec integration tests
2011-10-11 16:53 734in integration test, you can te ...
相关推荐
c++ 期货接口文档 CTP 客户端开发 综合交易平台API技术
文件版本6.3.9600.16384。内有操作说明。在复制覆盖前一定要备份原来的文件。mstsc.exe(这个文件在c:\windows\system32下面)mstscax.dll(这个文件在c:\windows\system32下面)mstsc.exe.mui(这个文件在c:\windows\...
SunloginClient_6.3.3.49311.apk.1
UBNT XM.v6.3.2.33267.200715.1657 官方固件
1、文件内容:fetchmail-6.3.24-7.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/fetchmail-6.3.24-7.el7.tar.gz #Step2、进入解压后的目录,执行安装 ...
glm-doc-0.9.6.3-1.el7.noarch.rpm
6.3.15-API接口说明.chm
《Ckplayer(6.3)整合光线(1.5)——实现高效视频播放与优化技术解析》 在数字化信息时代,视频已经成为重要的信息传播媒介,而高效的视频播放器则是确保用户流畅体验的关键。Ckplayer是一款广泛使用的开源HTML5视频...
6.3.1.10 探索网络互连设备.pka
SFIT_CTP_6.3.11_20180109_tradeapi.zip ctp量化交易代码
batik-1.7-6.3.el6.i686.rpm是centos开发工具包。
6.3 基于RBF神经网络的辨识.pptx
EhLib是一个专门为Delphi开发者设计的组件库,版本号为6.3.168,包含在名为"EhLib.6.3.Build.6.3.168.7z"的压缩包中。这个组件库是为提高Delphi应用程序的性能和功能而创建的,特别是对于数据库应用开发,提供了丰富...
EhLib是一款专门为Delphi开发环境设计的第三方控件库,其版本号为6.3.168,集成了丰富的组件和功能,为开发者提供了更便捷、高效的应用程序开发工具。这个压缩包包含了所有必要的文件,使得用户可以轻松安装并使用...
Pydroid_3_v6.3_arm-MD_yxssp.com.apk
数学建模6.3传染病模型PPT学习教案.pptx
OracleLinux6.3安装图示文档[汇编].pdf