creating favorite

parent 55bb5b9b
class JobFavoritesController < ApplicationController
before_action :sign_in_validation, only: [:create, :destroy]
before_action :find_job_id, only: [:new]
def create
end
def destroy
......
......@@ -17,8 +17,8 @@
<%= link_to 'Read more..', job_detail_path(job.id) %>
</div>
</div>
<%= link_to follow_job_path(job.id) do %>
<button type="button" class="btn btn-primary" id="button-follow">♥ Follow</button>
<%= form_for(:job_favorite, url: follow_job_path(job.id), remote: true) do |f| %>
<%= f.submit "♥ Follow", class: "btn btn-primary", id: "button-follow" %>
<% end %>
</div>
</div>
......
......@@ -33,7 +33,7 @@ Rails.application.routes.draw do
get 'jobs/industry/:converted_name', to: 'jobs#industry_jobs', as: :industry_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_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