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.

4

1 に答える 1

0

Rails 2.3.8はネストされた関連付けを受け入れないため、別のモデルのスコープを使用してこれを実現する必要があります。

ここで解決策を見つけました

ありがとう。

于 2012-05-26T21:07:31.890 に答える