Filter Tree View Rows #11

Closed
douglascamata opened this Issue Feb 25, 2013 · 7 comments

Comments

Projects
None yet
2 participants
@douglascamata

I want to filter my tree view rows as I did in my listing. is that possible? How?

@douglascamata

This comment has been minimized.

Show comment Hide comment
@douglascamata

douglascamata Feb 25, 2013

I tried to filter the rows using this tutorial and the tree view doesn't filter and can't even save the editions.

I tried to filter the rows using this tutorial and the tree view doesn't filter and can't even save the editions.

@dalpo

This comment has been minimized.

Show comment Hide comment
@dalpo

dalpo Feb 26, 2013

Owner

Are you using the 0.0.9 version?

Owner

dalpo commented Feb 26, 2013

Are you using the 0.0.9 version?

@douglascamata

This comment has been minimized.

Show comment Hide comment
@douglascamata

douglascamata Feb 26, 2013

Yes, sir. I guess I found the problem and it's inside Ancestry. I have a Category model, without any default scope, and a TreelessCategory model, that inherits Category, with a default_scope.

When I call arrange (the method that builds the object list) in TreelessCategory, my scope is totally ignored. But when I move the scope to Category and call arrange there, it works as expected.

If you're familiar with Ancenstry, we could track and fix this. I tried but I'm not familiar with it and I may be going the wrong path. What do you think?

Yes, sir. I guess I found the problem and it's inside Ancestry. I have a Category model, without any default scope, and a TreelessCategory model, that inherits Category, with a default_scope.

When I call arrange (the method that builds the object list) in TreelessCategory, my scope is totally ignored. But when I move the scope to Category and call arrange there, it works as expected.

If you're familiar with Ancenstry, we could track and fix this. I tried but I'm not familiar with it and I may be going the wrong path. What do you think?

@douglascamata

This comment has been minimized.

Show comment Hide comment
@douglascamata

douglascamata Feb 26, 2013

I've create a issue in Ancestry to keep track of this bug.

I've create a issue in Ancestry to keep track of this bug.

@dalpo

This comment has been minimized.

Show comment Hide comment
@dalpo

dalpo Feb 26, 2013

Owner

Ancestry ignores default scopes when moving or destroying nodes, ensuring tree consistency.

If you are using the same model to manage two differente tree you could try to implement a Single Table Inheritance:
http://api.rubyonrails.org/classes/ActiveRecord/Base.html#label-Single+table+inheritance

Owner

dalpo commented Feb 26, 2013

Ancestry ignores default scopes when moving or destroying nodes, ensuring tree consistency.

If you are using the same model to manage two differente tree you could try to implement a Single Table Inheritance:
http://api.rubyonrails.org/classes/ActiveRecord/Base.html#label-Single+table+inheritance

@douglascamata

This comment has been minimized.

Show comment Hide comment
@douglascamata

douglascamata Feb 26, 2013

I'm managing one tree in the Category model, but I need one additional view with a scope, that explains the existence of TreelessCategory. Nevermind the "treeless" in the model's name, it's just part of the problem I'm solving. When I moved the scope do Category, it worked in the tree view but kinda messed up stuff that uses the Category listing and should not be scoped.

I'm managing one tree in the Category model, but I need one additional view with a scope, that explains the existence of TreelessCategory. Nevermind the "treeless" in the model's name, it's just part of the problem I'm solving. When I moved the scope do Category, it worked in the tree view but kinda messed up stuff that uses the Category listing and should not be scoped.

@douglascamata

This comment has been minimized.

Show comment Hide comment
@douglascamata

douglascamata Feb 26, 2013

Solved this putting

def self.base_class
  self
end

In my TreelessCategory model.

Solved this putting

def self.base_class
  self
end

In my TreelessCategory model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment