fools-gold / crossroads

0 stars 0 forks source link

Add Like #13

Closed CarsomyrJ closed 9 years ago

CarsomyrJ commented 9 years ago

Closes #12.

woongy commented 9 years ago

10 참고해서 Status#likes_count 까지 붙이면 모델은 대충 완료될 듯?

woongy commented 9 years ago

그럼 여기에 뷰를 붙이면 어떻게 될까?

woongy commented 9 years ago

@CarsomyrJ 지금 라이크는 POST statuses/:status_id/likes, 라이크 취소는 DELETE statuses/:status_id/likes/:id로 하고 있지. 유저가 라이크를 한 번밖에 줄 수 없는데 라이크 id를 지정할 필요가 있을까?

CarsomyrJ commented 9 years ago

Rails의 form_for helper가 singular resource에 대해서 라우트를 잘 못찾는 버그가 있는 것 같다. 2010년도에 이미 발견된 버그인데 아직 딱히 고쳐지지 않은듯...해서 조금 찜찜하지만 form_for의 :url 옵션을 직접 수정함.

https://rails.lighthouseapp.com/projects/8994/tickets/267

woongy commented 9 years ago

음.. 내가 오해의 소지가 있게 코멘트를 달았구나 이전 라우트가 틀렸다는 뜻은 아니었고, 다른 방법도 있을 수 있다는 얘기를 하고 싶었음. 예를 들어 resources :likes를 아예 없애고 on: :member 액션으로 StatusesController에서 처리할 수도 있고, resources :likes를 한 단계 위로 꺼내서 status_id를 파라미터로 받을 수도 있지. 이건 내일 오프에서 이야기를 더 하는 걸로...