2011-01-16 1 views
1
나는 그들이 모델 등으로 모델을 넣어 예를 발견 DataMapper documentation for associations에서

... DataMapper는 : 모델로 모델을 두는 것은

1 class Person 
2 
3 class Link 
4 
5  include DataMapper::Resource 
6 
7  storage_names[:default] = 'people_links' 
8 
9  # the person who is following someone 
10  belongs_to :follower, 'Person', :key => true 
11 
12  # the person who is followed by someone 
13  belongs_to :followed, 'Person', :key => true 
14 
15 end 
16 
17 include DataMapper::Resource 
18 
19 property :id, Serial 
20 property :name, String, :required => true 
21 ... 

은 당신이 돌아 오기이거나 결과에 어떤 영향이 있습니까 그냥 다른 표기법이나 형식? 사전에

감사합니다, 루퍼스

답변

1

아니,이 결과에 영향을 미치지 않습니다.

모델을 네임 스페이스에 넣으면 저장소 이름에 반영됩니다. 이것이 위의 예제에서 링크 모델에서 "storage_names [: default] = 'people_links'"를 볼 수있는 이유는 해당 모델이 Person namespace 내에 있으므로 "people_links"테이블 이름에 반영되기 때문입니다.

+0

빠른 답변 감사드립니다. – rufus