0

I have this structure:

Enterprise
  has_many :projects

Projects
  has_many :clients

Clients
  has_many :tasks

I'm trying to give each Enterprise a start from 1 to their tasks. So, I did:

Tasks
  to_param
    uid.to_s
  end

And in my controllers to find a Task:

Task.find_by_uid(params[:id])

All urls are pretty, scoping the task number per enterprise. (I handle the uid at the task creation, incrementing the last uid from the same enterprise)

However, the Task.find_by_uid doesn't scope only tasks from the current_user.enterprise.

It seems to be a very noob question, by I'm struggling to find out a solution.

Please, help. Thanks.

Valadares
  • 77
  • 9

1 Answers1

0

As Rails 2.3.8 doen't accept nested associations, you must accomplish that with some scope in another models.

Found the solution here

Thanks.

Valadares
  • 77
  • 9