Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

awesome_nested_set: Impossible move, target node cannot be inside moved tree #142

Closed
sharp opened this issue May 21, 2012 · 2 comments
Closed

Comments

@sharp
Copy link

sharp commented May 21, 2012

#encoding: utf-8
class Grade < ActiveRecord::Base
  acts_as_nested_set
  attr_accessible :name, :parent_id
  has_many :subjects
  scope :stages, where("parent_id is null")
  scope :list, where("parent_id <> ''")
  #scope :excluding_ids, lambda { |ids| where(['id NOT IN (?)', ids]) if ids.any?}

end

This my seeds

puts "start import "
stage = Grade.create :name => "grade"
["grade1", "grade2"].each do |name|
  grade = Grade.create :name => name, :parent_id => stage.id
end

When I run rake db:seed, it shows

rake aborted! Impossible move, target node cannot be inside moved tree.

@sharp sharp closed this as completed May 21, 2012
@sharp
Copy link
Author

sharp commented May 21, 2012

I just type the wrong column: rgt -> rft

@lucasprag
Copy link

For me I had corrupted data, so I did this: Model.rebuild!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants