creating favorite

parent 55bb5b9b
class JobFavoritesController < ApplicationController class JobFavoritesController < ApplicationController
before_action :sign_in_validation, only: [:create, :destroy] before_action :sign_in_validation, only: [:create, :destroy]
before_action :find_job_id, only: [:new]
def create def create
end end
def destroy def destroy
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
<%= link_to 'Read more..', job_detail_path(job.id) %> <%= link_to 'Read more..', job_detail_path(job.id) %>
</div> </div>
</div> </div>
<%= link_to follow_job_path(job.id) do %> <%= form_for(:job_favorite, url: follow_job_path(job.id), remote: true) do |f| %>
<button type="button" class="btn btn-primary" id="button-follow">♥ Follow</button> <%= f.submit "♥ Follow", class: "btn btn-primary", id: "button-follow" %>
<% end %> <% end %>
</div> </div>
</div> </div>
......
...@@ -33,7 +33,7 @@ Rails.application.routes.draw do ...@@ -33,7 +33,7 @@ Rails.application.routes.draw do
get 'jobs/industry/:converted_name', to: 'jobs#industry_jobs', as: :industry_jobs get 'jobs/industry/:converted_name', to: 'jobs#industry_jobs', as: :industry_jobs
get 'jobs/company/:converted_name', to: 'jobs#company_jobs', as: :company_jobs get 'jobs/company/:converted_name', to: 'jobs#company_jobs', as: :company_jobs
post 'follow_job', to: 'job_favorites#create', as: :follow_job post 'follow_job/:id', to: 'job_favorites#create', as: :follow_job
resources :job_favorites, only: [:create, :destroy] resources :job_favorites, only: [:create, :destroy]
resources :job_applieds,only: [:new, :create] resources :job_applieds,only: [:new, :create]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment