文章列表
1 Self 关键字
self标识本身,self和Java中的this有些类似,代表当前对象
class User < ActiveRecord::Base
def self.sha256(username,password)
Digest::SHA256.hexdigest(username+password)
end
end
这里的self 表示
在一class内可以省略语句中attribute ...
1 Rails 2.0 里视图应该怎样写?
views/product/index.html.erb:
<%= render :partial => @product %>
_product.html.erb:
<% div_for product do %>
<h2><%= link_to h(product.name), product %></h2>
...
<% end %>
2 first ror2.0 blog demo
ht ...
今天的学习记录 :2008-3-20
1 字符串中插入表达式 “”最好
2 generate controller 是应该输入复述形式(对应表名) model 则是单数
3 关系的表达 has_many :works belongs_to :composer
class Composer < ActiveRecord::Base
ddhas_many :works
4 class Customer &l ...
1 下载 InstantRails-2.0-win
2 下载 RadRails
I have rails 2 installed on my machine and I have ran into an error when I created my controller login but when I go to http://localhost:3000/login/index I get this error:
No route matches "/login/index" with {:method=>:get}
重启服务器居然就好了
- 2008-03-17 20:15
- 浏览 930
- 评论(0)