1
우려 자원 문제는레일 4 - 내가 내 응용 프로그램에 레일 4 우려에 문제가
concern :common do
resources :comments
resources :categories
resources :tags
end
resources :articles, concerns: :common
resources :messages, concerns: :common
내가 직면 한 문제는 내가 통해 자원 메시지 (예 생성, 편집) 특정 컨트롤러 액션을 추가 할 것입니다 우려. 걱정거리를 전달하는 법을 모르겠습니다. 나 자원 정의 내가이 문제를 해결하는 것입니다 희망
concern :common do |options|
resources :comments, options
resources :categories, options
resources :tags, options
end
resources :articles, concerns: :common
resources :messages do
concerns: :common, only: :create,:edit
end
를 통해이 문제를 선택적 인수 우려로 전달 될 수
어떻게 비슷한 로직을 app/concerns/common.rb에서 처리 할 수 있습니까? –
self.call (mapper, options) mapper.resources : comments, options ....를 사용할 수 있습니다. – geekdev
내 시간을 저장했습니다. +1 –