I’m a new ruby, now i have a newbie problem
I have three model
1.
class SfProduct < ActiveRecord::Base
has_many :sf_actions_maps
def sf_add_user_to_action_map()
sf_actions_maps << SfProductMap.new()
end
end
class SfProductMap < ActiveRecord::Base
belongs_to :sf_product
belongs_to :sf_user
class SfUser < ActiveRecord::Base
has_many :sf_products_maps
product controller create code :
def create
@sf_product = SfProduct.new()
@sf_product.sf_add_user_to_action_map(@sf_user)
respond_to do |format|
if @sf_activity.save
else
end
end
afert user the create actions, the error will be show:
You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.delete
please help me!