-
0 votesanswersviews
cakephp找到all和afterFind方法
我有一个模型,它有一个belongsTo变量,find和一个afterFind都在玩 . 问题是,当afterFind被注释掉时,find工作正常,但是一旦它在播放中,find只返回“true”,而不是一个对象数组 . 如果有人遇到这个问题请通知我thx! 模型: public $belongsTo = array( 'User' => array( ... -
1 votesanswersviews
如何清理在rails 3中使用belongs_to获得的对象
我有两个类:User和Message . 以下是定义: class Message < ActiveRecord::Base belongs_to :receiver, :class_name => 'User', :foreign_key => 'receiver' belongs_to :sender, :class_name => 'User', :... -
0 votesanswersviews
Rails,如何通过浅层嵌套资源中的子对象访问belongs_to(父)对象?
所以,首先我在我的项目中进行了这种关联: 的routes.rb resources :users do resources :articles, only: [:new, :index, :create] end resources :articles, only: [:show, :edit, :update, :destroy] do resrouces :comments...