Sebastien Auriault

Developer

Posts

💎Rails tip: Exists?

Sebastien Auriault on Dec 04, 2021
Do you sometimes simply need to know if a record exists and not get its data? ActiveRecord gives you this convenient method "exists?" to do exactly that, in a performant way.

💎Ruby tip: Pulling code and get up-to-date alias

Sebastien Auriault on Nov 27, 2021
Do you often have to run bundle, yarn install and run migrations after pulling code? Here's a convenient alias to do all that for you.

💎Ruby tip: Debugging exit all

Sebastien Auriault on Nov 20, 2021
Debugging with IRB/Pry and stuck in a loop or just don't wanna go through all the stops typing exit all the time? No need to shut down your server! Simply type 'abort'. This will exit out of all future stops.

💎Rails tip: Rails Runner

Sebastien Auriault on Nov 13, 2021
Did you know that you can use Rails runner command to run Ruby code from the terminal directly in the context of your application without having to go in the Rails console?

💎Rails tip: Rails console sandbox

Sebastien Auriault on Nov 06, 2021
Need to test some code that runs queries? The Rails console sandbox is the perfect place to play around without affecting your development data.

💎Ruby tip: Discover methods

Sebastien Auriault on Oct 30, 2021
Trying to remember a method name or just discover what you can call on an object? Ruby has you covered!

💎Rails tip: Console custom methods

Sebastien Auriault on Oct 23, 2021
Did you know you can add custom methods automatically available in the Rails console? Useful for things you often need to do in the console like logging in.

💎Rails tip: Debugging views

Sebastien Auriault on Oct 16, 2021
Did you know that since Rails 6.1, you can add one line in your config to have comments added to your HTML showing you where each part of your view comes from (layout, component, partial..)? Useful for debugging views in the browser.

💎Rails tip: Association extraction

Sebastien Auriault on Oct 09, 2021
Did you know there's an ActiveRecord method that allows you to extract associations from a relation?

💎Rails tip: Form namespaces

Sebastien Auriault on Oct 02, 2021
Did you know you can add a namespace to your forms so that you don't need to manually specify the URL when the model doesn't match the controller's namespace? Useful when your app can use the same resource in different places.

💎Rails tip: Model validations on contexts

Sebastien Auriault on Sep 25, 2021
Did you know you can add model validations for only create, update, or even custom contexts?

💎Rails tip: Default value for belongs_to associations

Sebastien Auriault on Sep 18, 2021
Did you know you can set a default value to belongs_to associations?