Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I can save one Outline and it works fine, but if two objects are being save, target turns up nil.
- ## controller action
- if params.has_key?(:new_outline_items)
- params[:new_outline_items].each do |attributes|
- @current_course.outlines << Outline.new(attributes.merge!(:account_id => @current_account.id))
- end
- end
- @current_course.save!
- ## Model
- after_create :set_outlined
- def set_outlined
- target.update_attribute(:outlined,true)
- end
- ## error [plain]
- NoMethodError (You have a nil object when you didn't expect it!
- The error occurred while evaluating nil.outlined=):
- /app/models/outline.rb:10:in `set_outlined'
Add Comment
Please, Sign In to add comment