2008-03-25

rais324

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和function里的self关键字(self.id->id),但有一例外,就是在赋值的时候, self.name = "Jom"不能省为name = "Jom",因 ...
2008-03-21

rails321

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 http://www.vimeo.com/4 ...
2008-03-21

rails320

今天的学习记录 :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 < ActiveRecord::Base ddhas_many :orders, ddddddddddd:dependent => true, ddddddddddd:orde ...
2008-03-17

rails-1

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} 重启服务器居然就好了
  • 20:15
  • 浏览 (167)
  • 评论 (0)
jxauyhj
搜索本博客
博客分类
最近加入圈子
最新评论
评论排行榜