Ticket #7 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

scope error when using Symbol

Reported by: eevar2 Assigned to: jcm
Priority: major Milestone: 0.1 with tests
Component: plugin Version: trunk
Keywords: Cc: yaroslav@markin.net

Description

<eevar2> hi. you're the author of the better_nested_set plugin? I'm having some issues, think they're related to the code for dealing with scope, i.e. line 80 or so

my model does

acts_as_nested_set :scope => :client

which gives the following sql for #root():

SELECT * FROM accounts WHERE (client_id.nil? ? 
               "client_id IS NULL" : "client_id = #{client_id}" AND (parent_id IS NULL))  LIMIT 1

more to the issue than i'm grasping i think. lots of the sql seems to have ruby code in it -- if it isn't just some weird sql dialect.

Attachments

scoping.diff (10.4 kB) - added by yaroslav@markin.net on 09/12/06 13:22:46.
A patch which allows symbol scoping and dynamic scoping just as in acts_as_nested_set

Change History

08/24/06 17:42:47 changed by jcm

  • status changed from new to assigned.

You're right, scope doesn't work correctly when using Symbols. I'll have a look on this.

09/10/06 17:57:50 changed by yaroslav@markin.net

Sorry, any progress on this? :(

09/12/06 13:22:46 changed by yaroslav@markin.net

  • attachment scoping.diff added.

A patch which allows symbol scoping and dynamic scoping just as in acts_as_nested_set

09/12/06 16:45:58 changed by jcm

Yaroslav,

Good !

I think there is a problem though with class methods, like Class.root THe way it's implemented in old nested set won't work on this regard. I'll have a look asap.

09/21/06 19:22:47 changed by yaroslav@markin.net

  • cc set to yaroslav@markin.net.

10/10/06 13:30:28 changed by jcm

  • version set to trunk.
  • component changed from component1 to plugin.
  • milestone set to 0.1 with tests.

11/15/06 16:32:01 changed by Krishna

  • status changed from assigned to closed.
  • resolution set to fixed.

I applied a set of changes almost identical to those in the patch, and the scope tests pass.