我可能很愚蠢,但是:
@activation_token = ActivationToken.where(:token => params[:id])
render(:text => @activation_token.inspect)
工作,并给出:
[#<ActivationToken id: 7, user_id: 21, token: "f4c3cb7c7629344e8261bf16e4a99900", used: false, created_at: "2013-01-25 10:48:57", updated_at: "2013-01-25 10:48:57">]
但
@activation_token.user_id
抛出:
undefined method `user_id' for #<ActiveRecord::Relation:0x007fbfe414ff18>
我错过了什么?