Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def people_scope
- @account ? @account.people : Person
- end
- def find_person(key = :id)
- @person = people_scope.find_by_id(params[key])
- raise NotFound unless @person
- end
- # or
- def find_folder(key = :id)
- @folder = Folder.find_by_id(params[key])
- raise NotFound unless @folder
- end
- def build_folder(key = :folder)
- @folder = folders_scope.new(params[key])
- end
- def folders_scope
- @project ? @project.folders : Folder
- end
Add Comment
Please, Sign In to add comment