Skip to content

Instantly share code, notes, and snippets.

@shawndeprey
Created July 30, 2018 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawndeprey/1b4f990fa2503e1ef7d591eeb20fd132 to your computer and use it in GitHub Desktop.
Save shawndeprey/1b4f990fa2503e1ef7d591eeb20fd132 to your computer and use it in GitHub Desktop.

https://github.com/ashehdula/rails/blob/master/Gemfile#L7 When it comes to library management, you should consider locking your gemfile to specific versions of libraries. The reason is that these will upgrade dot-versions without your knowledge at times, making your stack unstable. You should do the same on the front-end as well.

# Instead of: gem 'rails', '~> 5.2.0'
gem 'rails', '= 5.2.0'

https://github.com/ashehdula/rails/blob/master/app/controllers/monsters_controller.rb Indentation bro! Always write beautiful code! ALWAYS!

Also, you should structure your GET/POST/UPDATE/DESTROY functions before your helper functions. Your helper functions should also be private to your controller.

# Anything below a private tag in Ruby will be private to your Object.
private
def monster_params
  params.require(:monster).permit(:active,:name,:level)
end

https://github.com/ashehdula/rails/blob/master/app/serializers/monster_serializer.rb Well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment