File tree 2 files changed +4
-6
lines changed
2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change 9
9
<% if @current_user %>
10
10
<% like = Like . find_by ( user_id : @current_user . id , note_id : @note . id ) %>
11
11
<% if like %>
12
- <%= form_tag "/likes/destroy" do %>
13
- < input type ="hidden " name ="note_id " value ="<%= @note . id %> ">
12
+ <%= form_tag "/notes/#{ @note . id } /destroy_like" do %>
14
13
< span class ="fa fa-heart unlike "> </ span >
15
14
< input type ="submit " value ="お気に入り済み(<%= @note . likes . count %> ) " class ="unlike ">
16
15
<% end %>
17
16
<% else %>
18
- <%= form_tag '/likes/create' do %>
19
- < input type ="hidden " name ="note_id " value ="<%= @note . id %> ">
17
+ <%= form_tag "/notes/#{ @note . id } /create_like" do %>
20
18
< span class ="fa fa-heart like "> </ span >
21
19
< input type ="submit " value ="お気に入り(<%= @note . likes . count %> ) " class ="like ">
22
20
<% end %>
Original file line number Diff line number Diff line change 1
1
Rails . application . routes . draw do
2
2
get 'users/:user_id/likes' => 'likes#index'
3
- post 'likes/create ' => 'likes#create'
4
- post 'likes/destroy ' => 'likes#destroy'
3
+ post '/notes/:note_id/create_like ' => 'likes#create'
4
+ post '/notes/:note_id/destroy_like ' => 'likes#destroy'
5
5
6
6
get 'signup' => 'users#new'
7
7
get 'login' => 'users#login_form'
You can’t perform that action at this time.
0 commit comments