#55 楼 @help5305fff 哇,5 年。。。能让他分享点东西吗
#53 楼 @help5305fff 我这边也有几个人玩 ruby 的,但是都是跟我一样最近才开始玩
#51 楼 @help5305fff 谁来讲,我可以组织
刚建了一个深圳的 qq 群:193151510
深圳的要不搞场聚会吧
其实楼主已经用 mongodb+mongoid 了 datamapper 看到很多都不推荐 其实对小项目来说,mongodb 和 postgres 或者 mysql 都区别不大,都是存数据而已嘛
对我一个 javaer 来说,最无缝的还是 mongoid 感觉跟以前用 orm 差不多
不过只是需要重新投入学习 mongobd 的语法的成本罢了
我有兴趣加入~~~
在 config 的 devise.rb 中找到一行,修改成 get # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :get
刚查了下请求,发现怎么发都是 get,我已经申明了是 delete 了,太诡异了
那个获取的效果咋做的,如果 input 没有填写就禁用
怎么改的
#22 楼 @chinacheng 看过了,他的文档就那么一点,也 google 了,我使用 mongodb 的,用的 mongoid 的 gem,按照他的方式生成了,现在不存数据库了,,反正就学习来说影响不大
#20 楼 @chinacheng undefined method `collection_name=' for Kindeditor::Asset:Class 就这个错误,我要是不用存数据库,那么就不会有错。。囧
#18 楼 @chinacheng 执行了,他生成 model 了,但是还是报错
为什么我上传图片 undefined method `collection_name=' for Kindeditor::Asset:Class 出这个错误,我没看到他有 kindeditor_assets 这个 controller
#6 楼 @Tony612 class Post include Mongoid::Document field :author, type: String field :source, type: String field :platform, type: String field :size, type: String field :watch, type: Integer field :created_at, type: Date field :updated_at, type: Date field :description, type: String
has_and_belongs_to_many :categories has_and_belongs_to_many :tags
attr_accessor :category_names attr_accessible :category_names after_create :assign_categories validates :category_names, :presence => true
protected def assign_categories names = category_names.split(',') categories << names.map { |name| Category.find_or_create_by(name: name) } end
end
Processing by PostsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"wpRSwcGRKGYl53CI6AA3f0JcgTi8ePqy+S46z5dD5Hg=", "post"=>{"author"=>"asdasd fdsfadda", "source"=>"asdas", "platform"=>"asd", "size"=>"asdasd", "watch"=>"asdas", "description"=>"dasd", "category_names"=>"audio"}, "commit"=>"Create Post"} WARNING: Can't mass-assign protected attributes: author, source, platform, size, watch, description MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} (0.6020ms) MOPED: 127.0.0.1:27017 INSERT database=code4_development collection=posts documents=[{"_id"=>"5041a56cc3666e0d04000003", "category_ids"=>[], "tag_ids"=>[], "created_at"=>2012-09-01 00:00:00 UTC}] flags= MOPED: 127.0.0.1:27017 QUERY database=code4_development collection=categories selector={"$query"=>{"name"=>"audio"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 fields=nil (0.4461ms) MOPED: 127.0.0.1:27017 UPDATE database=code4_development collection=posts selector={"_id"=>"5041a56cc3666e0d04000003"} update={"$addToSet"=>{"category_ids"=>"503c666be448126d11000002"}} flags= MOPED: 127.0.0.1:27017 UPDATE database=code4_development collection=categories selector={"_id"=>"503c666be448126d11000002"} update={"$addToSet"=>{"post_ids"=>{"$each"=>["5041a56cc3666e0d04000003"]}}} flags= Redirected to http://localhost:3000/posts/5041a56cc3666e0d04000003 Completed 302 Found in 5107ms
Started GET "/posts/5041a56cc3666e0d04000003" for 127.0.0.1 at 2012-09-01 14:04:28 +0800 Processing by PostsController#show as HTML Parameters: {"id"=>"5041a56cc3666e0d04000003"} MOPED: 127.0.0.1:27017 QUERY database=code4_development collection=posts selector={"_id"=>"5041a56cc3666e0d04000003"} flags=[] limit=0 skip=0 fields=nil (0.3986ms) Rendered posts/show.html.erb within layouts/application (2.7ms) MOPED: 127.0.0.1:27017 QUERY database=code4_development collection=categories selector={} flags=[] limit=0 skip=0 fields=nil (0.6080ms) Completed 200 OK in 13ms (Views: 11.4ms)
#1 楼 @camel => {"utf8"=>"✓", "authenticity_token"=>"wpRSwcGRKGYl53CI6AA3f0JcgTi8ePqy+S46z5dD5Hg=", "post"=> {"author"=>"asdasd ", "source"=>"dasd", "platform"=>"ddd", "size"=>"ddd", "watch"=>"ddd", "description"=>"ddd", "category_names"=>"audio"}, "commit"=>"Create Post", "action"=>"create", "controller"=>"posts"} 我帖的是 post 的值