Skip to content
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

MediaRanker Waves1-3 #44

Open
wants to merge 12 commits into
base: ash/master
Choose a base branch
from

Conversation

annaleeherrera
Copy link

Last thing to do: Hide files in GitIgnore

Completed waves 1-3

@a-lmx a-lmx self-assigned this Jan 6, 2016
end

def show
@book = Book.find(params[:id])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you use this line several times, you can DRY up your code by extracting it into a separate private method and calling that method instead. You can then also set it up as a before action scoped to show, edit, and update. Eg.

before_action: find_book, only: [:show, :edit, :update]

private

def find_book
  return Book.find(params[:id])
end

@a-lmx
Copy link

a-lmx commented Jan 6, 2016

Really nice job on this project, @annaleeherrera . I like how clean and readable your code is. I left a few comments about consistency in formatting and a few tips for DRYing it up, but in general you're doing a great job at writing easy-to-read code, and it looks like you have a good understanding of Rails routing conventions and form helpers. The decision of whether to put code in Controllers or Models can be subjective, and you'll develop your own feeling for where you like to put various types of logic.

Keep up the good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants