#2 楼 @liuhui998 分类?你想说啥
我果然是菜鸟.... http://gitscore.com/user/crhan
嗯..最后问题解决的时候再张贴下问题的原因和解决的办法....有始有终嘛
..为啥这样判断啊...我看教程里面有这样的写法,你参考一下
# User.rb
validates :nick, :uniqueness => true
validates :email, :uniqueness => true
这样子前两行就不用了...
而且你也应该多贴一点内容,比如你的 model 是怎么设定的。还有具体的 log 是怎么样的。详见 提问的智慧
我在 gitlab 的代码里看到是这样的
admin = params[:user].delete("admin")
admin_user = User.new(params[:user])
admin_user.admin = admin
admin_user.save!
blablabla
#18 楼 @aNdReW_Qx - - 有道理...css 的问题...
可以去 contribute 一下....比如来个测试 bisect 的..
啊哈..还是挺有趣的~~~ 我都会诶 ~~~ 除了 Unified diff 格式没看懂,, 搜到了这里 才明白的
#28 楼 @night_song 不会啊..默认的 prefix 是 /usr/local
当然最好再加上 pry-doc...
#10 楼 @diudiutang 阿哈哈哈哈~ 有更好的方法~ 用 pry 来代替 irb!
# rails c
Loading development environment (Rails 3.2.3)
[1] pry(main)> stat Project.first
Method Information:
--
Name: first
Owner: ActiveRecord::Querying
Visibility: public
Type: Bound
Arity: -1
Method Signature: first(*args, &block)
Source Location: /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.3/lib/active_record/querying.rb:4
[2] pry(main)> show-method Project.first
From: /usr/local/rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.3/lib/active_record/querying.rb @ line 4:
Number of lines: 54
Owner: ActiveRecord::Querying
Visibility: public
module Querying
delegate :find, :first, :first!, :last, :last!, :all, :exists?, :any?, :many?, :to => :scoped
delegate :first_or_create, :first_or_create!, :first_or_initialize, :to => :scoped
delegate :destroy, :destroy_all, :delete, :delete_all, :update, :update_all, :to => :scoped
delegate :find_each, :find_in_batches, :to => :scoped
delegate :select, :group, :order, :except, :reorder, :limit, :offset, :joins,
:where, :preload, :eager_load, :includes, :from, :lock, :readonly,
:having, :create_with, :uniq, :to => :scoped
delegate :count, :average, :minimum, :maximum, :sum, :calculate, :pluck, :to => :scoped
好玩~的
#3 楼 @diudiutang 举例子可不是 API 文档该有的写法吧....而且这一段并不完全..像 :method
, :as
就没有写....
#5 楼 @leekelby 嗯..Ruby 还有 Ruby stdlib 的 API.... Rails 源码暂时还有点..没法看....
@tualatrix 主席...活动起来啊!
几乎没有明白你的问题...难道你要的不就是 self.属性名
么?