-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amy Kintner's job-tracker #12
base: master
Are you sure you want to change the base?
Conversation
…tory girl blowing up
has_many :contacts | ||
|
||
|
||
def self.top_3_by_average_interest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't see tests for these model methods
belongs_to :category | ||
has_many :comments | ||
|
||
def self.count_by_interest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here - don't forget to tests these methods!
|
||
def create | ||
@contact = Contact.new(contact_params) | ||
@contact.company_id = params[:company_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leverage your associations here rather than setting the foreign key manually
<div class="form-group"> | ||
|
||
<% if @category.errors.any? %> | ||
<h2><%= pluralize(@category.errors.count, "error") %> prohibited this record from being saved:</h2> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice use of pluralize 👍
<br/> | ||
<%= f.label :email %> | ||
<%= f.text_field :email %> | ||
<%= hidden_field_tag :company_id, @company.id %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can we avoid passing hidden fields in our forms?
|
||
<br/> | ||
<%= f.label :job_category %> | ||
<%= f.collection_select :category_id, Category.order(:title), :id, :title, include_blank: false %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid querying your database in your views (Category.order(:title)
)
<h3>Jobs in Each Location</h3> | ||
<% if self.count_by_location %> | ||
<ul class="by_location list-unstyled"> | ||
<li><%= <% Job.order(:city) %></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this from the view - let your controller get this data 👍
<ul class="nav navbar-nav"> | ||
<li class="nav navbar-nav"><a href="/dashboard">Job Dashboard</a></li> | ||
<li class="nav navbar-nav"><a href="/companies">Companies</a></li> | ||
<li class="nav navbar-nav"><a href="/categories">Job Categories </a></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leverage your rail's helpers - link_to
and your path helpers
@@ -0,0 +1,45 @@ | |||
FactoryGirl.define do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wooo factories 👍
require 'rails_helper' | ||
|
||
describe "User creates a new category" do | ||
scenario "a user can create a new category" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be sure to test your sad paths
hey @akintner - overall, good work with this. i made a few comments. be sure to remember to commit more often as well 👍 Rubric1) Database, Relationships, and Migrations
2) Routes
3) Controllers
4) ActiveRecord
5) Views
6) User Experience
7) Testing
|
No description provided.