Suppose we want to add a Theater model to Rotten Potatoes, with the assumption that a Theater is associated with one Movie, but a given Movie could be showing at many Theaters. In our Rails app we would like to be able to write movie.theaters to obtain a list of all the theaters at which a movie is showing. Which statement is correct?
A. The movies table will need a foreign key theater_id. We must add has_many :theaters to the Movie model. We must add has_many :movies to the Theater model. We must add belongs_to :theater to the Movie model.
B. We must add has_many :theaters to the Movie model.
C. We must add has_many :movies to the Theater model.
D. We must add belongs_to :theater to the Movie model.
查看答案
If using the DataMapper pattern with a NoSQL database and you want to do one-to-many associations, you can expect:
A. To have to write the association methods yourself
B. Better scalability
C. Worse scalability
D. All of the above are possible
If we also have moviegoer has_many reviews, can we use moviegoer_review_path() as a helper?
A. Yes, it should work as-is because of convention over configuration
B. Yes, but we must declare reviews as a nested resource of moviegoers in routes.rb
C. No, because there can be only one RESTful route to any particular resource No, because having more than one through-association involving Reviews would lead to ambiguity
D. No, because having more than one through-association involving Reviews would lead to ambiguity
如果在野外遇到意外致使腕部骨折,最方便的处理方法是( )。
A. 用另外一侧健手
B. 用伤者的衣服固定
C. 用夹板
D. 用软布
检查点说明表中第一行第二列表示( )。
A. 总爬高量
B. 路线长度
C. 组别
D. 检查点代号