I'm a new ruby, now i have a newbie problem
I have three model
1.
[code]
class SfProduct < ActiveRecord::Base
has_many :sf_actions_maps
def sf_add_user_to_action_map()
sf_actions_maps << SfProductMap.new()
end
end
[/code]
2.
[code]
class SfProductMap < ActiveRecord::Base
belongs_to :sf_product
belongs_to :sf_user
[/code]
3.
[code]
class SfUser < ActiveRecord::Base
has_many :sf_products_maps
[/code]
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!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.