#railstips search results

#RailsTips ๐ŸŒธ Small hack to reduce database call๐Ÿ’Ž On optional association, when u want to check associated model presence(country), instead of using - โฏ ๐˜‚๐˜€๐—ฒ๐—ฟ.๐—ฐ๐—ผ๐˜‚๐—ป๐˜๐—ฟ๐˜†.๐—ฝ๐—ฟ๐—ฒ๐˜€๐—ฒ๐—ป๐˜? you can use โฏ ๐˜‚๐˜€๐—ฒ๐—ฟ.๐—ฐ๐—ผ๐˜‚๐—ป๐˜๐—ฟ๐˜†_๐—ถ๐—ฑ.๐—ฝ๐—ฟ๐—ฒ๐˜€๐—ฒ๐—ป๐˜? #RubyOnRails

rishipi's tweet image. #RailsTips ๐ŸŒธ

Small hack to reduce database call๐Ÿ’Ž

On optional association, when u want to check associated model presence(country), instead of using - 

โฏ  ๐˜‚๐˜€๐—ฒ๐—ฟ.๐—ฐ๐—ผ๐˜‚๐—ป๐˜๐—ฟ๐˜†.๐—ฝ๐—ฟ๐—ฒ๐˜€๐—ฒ๐—ป๐˜? 

you can use 

โฏ  ๐˜‚๐˜€๐—ฒ๐—ฟ.๐—ฐ๐—ผ๐˜‚๐—ป๐˜๐—ฟ๐˜†_๐—ถ๐—ฑ.๐—ฝ๐—ฟ๐—ฒ๐˜€๐—ฒ๐—ป๐˜?

#RubyOnRails

#RailsTips ๐ŸŒธ Did u know that ActiveSupport::Inflector class has methods for transforming words & strings between different formats? This week we'll be going to explore couple of methods that you might not aware of. Have a look - #RubyOnRails

rishipi's tweet image. #RailsTips ๐ŸŒธ

Did u know that ActiveSupport::Inflector class has methods for transforming words & strings between different formats?

This week we'll be going to explore couple of methods that you might not aware of.

Have a look - 

#RubyOnRails

#ActiveSupport's `.presence` lets us write cleaner code. It returns the object if it's present, nil otherwise. No more tedious nil checks! Easily assign a default value when the parameter is nil or empty! #RailsTips #RubyTips #CleanCode

MyBuddyAndrew's tweet image. #ActiveSupport's  `.presence`  lets us write cleaner code. It returns the object if it's present, nil otherwise. No more tedious nil checks! Easily assign a default value when the parameter is nil or empty!  #RailsTips #RubyTips #CleanCode

#RailsTips ๐ŸŒธ More hidden gems from the ActiveSupport::Inflector class! Today we're exploring two methods you may not know about: demodulize and deconstantize. These can be handy for dynamically generating class and module names based on other information. #RubyOnRails

rishipi's tweet image. #RailsTips ๐ŸŒธ

More hidden gems from the ActiveSupport::Inflector class!

Today we're exploring two methods you may not know about: demodulize and deconstantize. 

These can be handy for dynamically generating class and module names based on other information. 

#RubyOnRails

#RailsTips ๐ŸŒธ Discovering more hidden gems from ActiveSupport::Inflector today! Check out constantize for dynamically loading class based on its name (great for plugins) and safe_constantize for gracefully handling cases where class may not exist. Have a look - #RubyOnRails

rishipi's tweet image. #RailsTips ๐ŸŒธ

Discovering more hidden gems from ActiveSupport::Inflector today! 

Check out constantize for dynamically loading class based on its name (great for plugins) and safe_constantize for gracefully handling cases where class may not exist.

Have a look - 

#RubyOnRails

#RailsTips ๐ŸŒธ Rails framework has lots of configs available. This week we'll be going to explore couple of configs that will be useful for most Rails apps - ๐Ÿ’Ž ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด.๐—ฑ๐—ถ๐˜€๐—ฎ๐—ฏ๐—น๐—ฒ_๐˜€๐—ฎ๐—ป๐—ฑ๐—ฏ๐—ผ๐˜… ๐Ÿ’Ž ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด.๐—ณ๐—ผ๐—ฟ๐—ฐ๐—ฒ_๐˜€๐˜€๐—น Have a look - #rubyonrails #rails

rishipi's tweet image. #RailsTips ๐ŸŒธ

Rails framework has lots of configs available.

This week we'll be going to explore couple of configs that will be useful for most Rails apps -

๐Ÿ’Ž ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด.๐—ฑ๐—ถ๐˜€๐—ฎ๐—ฏ๐—น๐—ฒ_๐˜€๐—ฎ๐—ป๐—ฑ๐—ฏ๐—ผ๐˜… 
๐Ÿ’Ž ๐—ฐ๐—ผ๐—ป๐—ณ๐—ถ๐—ด.๐—ณ๐—ผ๐—ฟ๐—ฐ๐—ฒ_๐˜€๐˜€๐—น

Have a look -

#rubyonrails #rails

#RailsTips ๐ŸŒธ Ready to explore more of ActiveSupport::Inflector? Today we're introducing ordinal and ordinalize, great for formatting dates and times, rankings, or any numbers in a user-friendly way. Have a look - #RubyOnRails

rishipi's tweet image. #RailsTips ๐ŸŒธ

Ready to explore more of ActiveSupport::Inflector?

Today we're introducing ordinal and ordinalize, great for formatting dates and times, rankings, or any numbers in a user-friendly way.

Have a look - 

#RubyOnRails

#RailsTips ๐ŸŒธ You can use the `render` method to display content in a different format such as JSON or XML. This can be useful when working with APIs. For example, to render a JSON response, you can add the code from this code-snippet to your controller action - #RubyOnRails

rishipi's tweet image. #RailsTips ๐ŸŒธ

You can use the `render` method to display content in a different format such as JSON or XML. This can be useful when working with APIs.

For example, to render a JSON response, you can add the code from this code-snippet to your controller action -

#RubyOnRails

#RailsTips ๐ŸŒธ Have you heard `assert_valid_keys` method from Hash class in Rails? It provides easy way to validate the keys of hash against list of expected keys and raises error if hash contains any keys that are not included in the expected list - #RubyOnRails #Rails

rishipi's tweet image. #RailsTips ๐ŸŒธ

Have you heard `assert_valid_keys` method from Hash class in Rails?

It provides easy way to validate the keys of hash against list of expected keys and raises error if hash contains any keys that are not included in the expected list -

#RubyOnRails #Rails

#railstips Interesting way to use `find_or_create_by` when you want to find by one parameter but create with additional parameters.

vickyonit's tweet image. #railstips

Interesting way to use `find_or_create_by` when you want to find by one parameter but create with additional parameters.

๐Ÿ’Ž Rails tip of the day: To eliminate N+1 query woes, always preload associations with `includes`: Save those DB hits! ๐Ÿš€ #RubyOnRails #RailsTips

MIbtehajNasar's tweet image. ๐Ÿ’Ž Rails tip of the day:

To eliminate N+1 query woes, always preload associations with `includes`:

Save those DB hits! ๐Ÿš€
#RubyOnRails #RailsTips

Protecting sensitive data in Rails logs is crucial for security & audit purposes. #securitytips For example, lets you hide the user's email id/CC from the log, it's quite simple #rails #railstips #part2 #rubyonrails

_rshiva's tweet image. Protecting sensitive data in Rails logs is crucial for security & audit purposes. #securitytips
For example, lets you hide the user's email id/CC from the log, it's quite simple
#rails #railstips #part2 #rubyonrails

#RailsTips ๐ŸŒธ Today we'll explore another useful method from the Active Support::Inflector class: #parametrize. Convert any string to a URL-friendly format, great for generating slugs, file names, and SEO-friendly URLs. Check it out! #RubyOnRails

rishipi's tweet image. #RailsTips ๐ŸŒธ

Today we'll explore another useful method from the Active Support::Inflector class: #parametrize. 

Convert any string to a URL-friendly format, great for generating slugs, file names, and SEO-friendly URLs.

Check it out!

#RubyOnRails

Save time & streamline your responses with #RubyOnRails' head method! Easily send HTTP status codes without extra content. Perfect for handling situations & errors gracefully. #RailsTips #CodingTips

itsAndL03's tweet image. Save time & streamline your responses with #RubyOnRails' head method! Easily send HTTP status codes without extra content. Perfect for handling situations & errors gracefully. #RailsTips #CodingTips

๐Ÿš€ Keep your Rails app dependencies up-to-date with a simple command: ๐Ÿ’Ž bundle outdated โœ”๏ธ Lists outdated gems without making changes โœ”๏ธ Lets you focus on safe, selective updates โœ”๏ธ Reduces risk of breaking changes Stay ahead of tech debt! #RubyOnRails #RailsTips


We start by creating a modal View Component for modular, reusable UI. ๐Ÿ› ๏ธย  Use Turbo Frames for dynamic content or static content for simplicity. The HTML structure includes a backdrop, panel, and form submission logic. #RailsTips


Essential Rails console tips help you improve on productivity, quick thread #rails #railstips #part1 #rubyonrails ๐Ÿงต


hkob ใฎ้›‘่จ˜้Œฒ็ฌฌ185ๅ›žใงใฏใ€NotionRubyMapping ใฎ FileBlock ใฎใƒžใƒ‹ใƒฅใ‚ขใƒซไฟฎๆญฃใซใคใ„ใฆ่ชฌๆ˜Žใ—ใ€FileBlock.new ใฎๅผ•ๆ•ฐใฎๅค‰ๆ›ดใ‚„ file_upload_object ใƒกใ‚ฝใƒƒใƒ‰ใฎ่ฟฝๅŠ ใ‚’่กŒใฃใŸใ“ใจใŒ่ฟฐในใ‚‰ใ‚Œใฆใ„ใพใ™ใ€‚(่ฆ็ด„ by Notion AI) #Notion #RailsTips NotionRubyMapping ใฎโ€ฆ hkob.hatenablog.com/entry/2025/07/โ€ฆ

hkob.hatenablog.com

NotionRubyMapping ใฎใƒžใƒ‹ใƒฅใ‚ขใƒซไฟฎๆญฃ(3) : hkob ใฎ้›‘่จ˜้Œฒ (185) - hkobโ€™s blog

hkob ใฎ้›‘่จ˜้Œฒ็ฌฌ185ๅ›žใงใฏใ€NotionRubyMapping ใฎ FileBlock ใฎใƒžใƒ‹ใƒฅใ‚ขใƒซไฟฎๆญฃใซใคใ„ใฆ่ชฌๆ˜Žใ—ใ€FileBlock.new ใฎๅผ•ๆ•ฐใฎๅค‰ๆ›ดใ‚„ file_upload_object ใƒกใ‚ฝใƒƒใƒ‰ใฎ่ฟฝๅŠ ใ‚’่กŒใฃใŸใ“ใจใŒ่ฟฐในใ‚‰ใ‚Œใฆใ„ใพใ™ใ€‚(่ฆ็ด„ by Notion AI)


๐Ÿ”ง 3 Ruby on Rails TILs You Should Know ๐Ÿ‘‡ โœ”๏ธ Validate dates smartly โœ”๏ธ Clean, readable URLs โœ”๏ธ Optimized image delivery Full post with code & tips ๐Ÿ‘‰ linkedin.com/feed/update/urโ€ฆ #RubyOnRails #RailsTips #TIL #DevLife #Codemancers #WebDev #Rails #DevTips

codemancershq's tweet image. ๐Ÿ”ง 3 Ruby on Rails TILs You Should Know ๐Ÿ‘‡

โœ”๏ธ Validate dates smartly

โœ”๏ธ Clean, readable URLs

โœ”๏ธ Optimized image delivery

Full post with code & tips ๐Ÿ‘‰ linkedin.com/feed/update/urโ€ฆ

#RubyOnRails #RailsTips #TIL #DevLife #Codemancers #WebDev #Rails #DevTips
codemancershq's tweet image. ๐Ÿ”ง 3 Ruby on Rails TILs You Should Know ๐Ÿ‘‡

โœ”๏ธ Validate dates smartly

โœ”๏ธ Clean, readable URLs

โœ”๏ธ Optimized image delivery

Full post with code & tips ๐Ÿ‘‰ linkedin.com/feed/update/urโ€ฆ

#RubyOnRails #RailsTips #TIL #DevLife #Codemancers #WebDev #Rails #DevTips
codemancershq's tweet image. ๐Ÿ”ง 3 Ruby on Rails TILs You Should Know ๐Ÿ‘‡

โœ”๏ธ Validate dates smartly

โœ”๏ธ Clean, readable URLs

โœ”๏ธ Optimized image delivery

Full post with code & tips ๐Ÿ‘‰ linkedin.com/feed/update/urโ€ฆ

#RubyOnRails #RailsTips #TIL #DevLife #Codemancers #WebDev #Rails #DevTips
codemancershq's tweet image. ๐Ÿ”ง 3 Ruby on Rails TILs You Should Know ๐Ÿ‘‡

โœ”๏ธ Validate dates smartly

โœ”๏ธ Clean, readable URLs

โœ”๏ธ Optimized image delivery

Full post with code & tips ๐Ÿ‘‰ linkedin.com/feed/update/urโ€ฆ

#RubyOnRails #RailsTips #TIL #DevLife #Codemancers #WebDev #Rails #DevTips

๐Ÿ’Ž Rails tip of the day: To eliminate N+1 query woes, always preload associations with `includes`: Save those DB hits! ๐Ÿš€ #RubyOnRails #RailsTips

MIbtehajNasar's tweet image. ๐Ÿ’Ž Rails tip of the day:

To eliminate N+1 query woes, always preload associations with `includes`:

Save those DB hits! ๐Ÿš€
#RubyOnRails #RailsTips

E2E test your Devise login with Cypress in < 2 minutes. #RailsTips #Cypress #Authentication


We start by creating a modal View Component for modular, reusable UI. ๐Ÿ› ๏ธย  Use Turbo Frames for dynamic content or static content for simplicity. The HTML structure includes a backdrop, panel, and form submission logic. #RailsTips


๐Ÿš€ Keep your Rails app dependencies up-to-date with a simple command: ๐Ÿ’Ž bundle outdated โœ”๏ธ Lists outdated gems without making changes โœ”๏ธ Lets you focus on safe, selective updates โœ”๏ธ Reduces risk of breaking changes Stay ahead of tech debt! #RubyOnRails #RailsTips


โšก๏ธ๐Ÿ› ๏ธ Turbocharge your Rails controllers now! ๐Ÿš€ Custom filters = Cleaner code ๐Ÿ”ฅ blog.oxyconit.com/streamlining-rโ€ฆ #RubyOnRails #WebDev #RailsTips


โœจ RAILS PRO TIPS โœจ Take the habit of using pick(*column_names) instead of pluck(*column_names).first โœจ๐Ÿ’ซ #ruby #rubyonrails

RubyCademy's tweet image. โœจ RAILS PRO TIPS โœจ

Take the habit of using pick(*column_names) instead of  pluck(*column_names).first โœจ๐Ÿ’ซ

#ruby #rubyonrails


#RailsTips Helper ๆ–นๆณ•ๆ˜ฏๅ…จๅฑ€ๆ–นๆณ•๏ผŒๅฆ‚ๆžœๅชๆ˜ฏไธชๅˆซๆจก็‰ˆ้œ€่ฆ๏ผŒๅœจๆจก็‰ˆๅ†…ไฝฟ็”จๅฑ€้ƒจๅ˜้‡ๅฐฑ่กŒไบ†ใ€‚


#RailsTips 85ๆ—ฅ็›ฎใงใฏใ‚ณใƒกใƒณใƒˆใฎ็™ป้Œฒใƒป็ทจ้›†ใƒปๅ‰Š้™คใ‚’ใƒšใƒผใ‚ธ้ท็งปใ—ใชใ„ใ‚ˆใ†ใซ TurboFrame ๅŒ–ใ—ใพใ—ใŸใ€‚ใพใŸใ€ใใฎ้š›ใซ Flash ใƒกใƒƒใ‚ปใƒผใ‚ธใ‚‚ๆ็”ปใ™ใ‚‹ใ‚ˆใ†ใซใ—ใฆใ„ใพใ™ใ€‚ #Rails ใ‚ณใƒกใƒณใƒˆใฎ turbo frame ๅŒ–: ๅฐๆž—็ ” Rails Tips (85) - hkobโ€™s blog hkob.hatenablog.com/entry/2024/02/โ€ฆ

hkob.hatenablog.com

ใ‚ณใƒกใƒณใƒˆใฎ turbo frame ๅŒ–: ๅฐๆž—็ ” Rails Tips (85) - hkobโ€™s blog

RailsTips ็ฌฌ85ๅ›žใงใฏใ€ใ‚ณใƒกใƒณใƒˆใฎ่ฟฝๅŠ ใƒป็ทจ้›†ใƒปๅ‰Š้™คใฎ้ƒจๅˆ†ใ‚’TurboFrameๅŒ–ใ—ใ€ใƒšใƒผใ‚ธ้ท็งปใชใ—ใงๆ›ดๆ–ฐใงใใ‚‹ใ‚ˆใ†ใซใ™ใ‚‹ๆ–นๆณ•ใ‚’็ดนไป‹ใ—ใฆใ„ใพใ™ใ€‚ใพใŸใ€Flashใƒกใƒƒใ‚ปใƒผใ‚ธใ‚’TurboFrameใงๆ‰ฑใ†ใŸใ‚ใฎๅทฅๅคซใซใคใ„ใฆใ‚‚่ฟฐในใฆใ„ใพใ™ใ€‚TurboFrameใฏไธ€็ฎ‡ๆ‰€ใ—ใ‹ๆ›ดๆ–ฐใงใใชใ„ใŸใ‚ใ€Flashใƒกใƒƒใ‚ปใƒผใ‚ธใŒๆ›ดๆ–ฐใงใโ€ฆ


#RailsTips 84ๆ—ฅ็›ฎใงใฏใƒญใ‚ฐใ‚คใƒณใ—ใฆใ„ใชใ„ๆ™‚ใฎใƒชใƒณใ‚ฏๅ‰Š้™คใชใฉใƒฆใƒผใ‚ถๅ‘จใ‚ŠใซใŠใ‘ใ‚‹็ดฐใ‹ใ„ไฟฎๆญฃใ‚’ใ—ใฆใ„ใพใ™ใ€‚ #Rails ใƒฆใƒผใ‚ถๅ‘จใ‚Šใฎไฟฎๆญฃ: ๅฐๆž—็ ” Rails Tips (84) - hkobโ€™s blog hkob.hatenablog.com/entry/2024/02/โ€ฆ

hkob.hatenablog.com

ใƒฆใƒผใ‚ถๅ‘จใ‚Šใฎไฟฎๆญฃ: ๅฐๆž—็ ” Rails Tips (84) - hkobโ€™s blog

RailsTipsใฎ84ๅ›ž็›ฎใงใฏใ€ใƒฆใƒผใ‚ถใƒผ้–ข้€ฃใฎใ„ใใคใ‹ใฎไธๅ…ทๅˆใ‚’ไฟฎๆญฃใ—ใพใ—ใŸใ€‚ใƒญใ‚ฐใ‚คใƒณใ—ใฆใ„ใชใ„ใจใใซๆ–ฐใ—ใ„่จ˜ไบ‹ใ‚’ไฝœๆˆใงใใชใ„ใ‚ˆใ†ใซใ—ใ€ใƒญใ‚ฐใ‚คใƒณใƒชใƒณใ‚ฏใ‚’่ฟฝๅŠ ใ—ใพใ—ใŸใ€‚ใพใŸใ€ใƒฆใƒผใ‚ถใƒผใฎๅๅ‰ใŒ็ฉบใงใ‚ใฃใŸๅ•้กŒใ‚‚่งฃๆฑบใ—ใพใ—ใŸใ€‚ใ‚ณใƒกใƒณใƒˆใฎ่ฟฝๅŠ ใ‚‚ใƒญใ‚ฐใ‚คใƒณใ—ใฆใ„ใ‚‹ใƒฆใƒผใ‚ถใƒผใฎใฟใซๅˆถ้™ใ—ใพใ—ใŸใ€‚ๆœ€ๅˆใ‹ใ‚‰่จญ่จˆใ‚’ใ—ใฃใ‹ใ‚Š่กŒใ‚ใชใ„ใจใ€ใ“ใฎใ‚ˆโ€ฆ


#RailsTips 83ๆ—ฅ็›ฎใงใฏใ‚ณใƒกใƒณใƒˆใƒขใƒ‡ใƒซใซใƒฆใƒผใ‚ถใ‚’่ฟฝๅŠ ใ—ใŸใฎใงใ€ใใ‚Œใซๅฏพๅฟœใ—ใŸใ‚ณใƒณใƒˆใƒญใƒผใƒฉใฎใƒ†ใ‚นใƒˆใจๅฎŸ่ฃ…ใ‚’ไฟฎๆญฃใ—ใพใ—ใŸใ€‚ #Rails ใ‚ณใƒกใƒณใƒˆใซใƒฆใƒผใ‚ถใ‚’่ฟฝๅŠ (ใ‚ณใƒณใƒˆใƒญใƒผใƒฉใฎไฟฎๆญฃ): ๅฐๆž—็ ” Rails Tips (83) - hkobโ€™s blog hkob.hatenablog.com/entry/2024/02/โ€ฆ

hkob.hatenablog.com

ใ‚ณใƒกใƒณใƒˆใซใƒฆใƒผใ‚ถใ‚’่ฟฝๅŠ (ใ‚ณใƒณใƒˆใƒญใƒผใƒฉใฎไฟฎๆญฃ): ๅฐๆž—็ ” Rails Tips (83) - hkobโ€™s blog

Rails Tips ใฎ 83 ๅ›ž็›ฎใงใฏใ€ใƒฆใƒผใ‚ถใƒผใ‚’ใ‚ณใƒกใƒณใƒˆใซ่ฟฝๅŠ ใ™ใ‚‹ๆ–นๆณ•ใ‚’ๅญฆใณใพใ—ใŸใ€‚ใƒขใƒ‡ใƒซใซใƒฆใƒผใ‚ถใƒผใ‚’่ฟฝๅŠ ใ—ใŸๅพŒใ€request spec ใ‚’ไฟฎๆญฃใ—ใ€ใ‚ณใƒณใƒˆใƒญใƒผใƒฉใŒๆญฃใ—ใๅ‹•ไฝœใ™ใ‚‹ใ‚ˆใ†ใซๅค‰ๆ›ดใ—ใพใ™ใ€‚ใƒ“ใƒฅใƒผใ‚‚ๅŒๆง˜ใซไฟฎๆญฃใ—ใ€็‰นใซ articles/comments/_form.html.haml ใจ articles/cโ€ฆ


#RailsTips 82ๆ—ฅ็›ฎใงใฏใ‚ณใƒกใƒณใƒˆใซใ‚‚ใƒฆใƒผใ‚ถใ‚’่ฟฝๅŠ ใ—ใพใ™ใ€‚ใ“ใกใ‚‰ใฏ่จ˜ไบ‹ใจ็•ฐใชใ‚Š nil ใ‚’่จฑๅฏใ™ใ‚‹้–ข้€ฃใซใ—ใฆใฟใพใ—ใŸใ€‚ #Rails ใ‚ณใƒกใƒณใƒˆใซใƒฆใƒผใ‚ถใ‚’่ฟฝๅŠ : ๅฐๆž—็ ” Rails Tips (82) - hkobโ€™s blog hkob.hatenablog.com/entry/2024/02/โ€ฆ

hkob.hatenablog.com

ใ‚ณใƒกใƒณใƒˆใซใƒฆใƒผใ‚ถใ‚’่ฟฝๅŠ : ๅฐๆž—็ ” Rails Tips (82) - hkobโ€™s blog

RailsTipsใฎ82ๅ›ž็›ฎใฏใ€ใ‚ณใƒกใƒณใƒˆใซใ‚‚ใƒฆใƒผใ‚ถใƒผใ‚’่ฟฝๅŠ ใ™ใ‚‹ๆ–นๆณ•ใ‚’่ชฌๆ˜Žใ—ใฆใ„ใพใ™ใ€‚่จ˜ไบ‹ใจๅŒๆง˜ใ€ใ‚ณใƒกใƒณใƒˆใซใ‚‚user_idใ‚’่ฟฝๅŠ ใ—ใพใ™ใŒใ€ใ‚ณใƒกใƒณใƒˆใฎuser_idใซใฏnullใŒ่จฑๅฏใ•ใ‚Œใฆใ„ใ‚‹็‚นใŒ็•ฐใชใ‚Šใพใ™ใ€‚ใ“ใ‚Œใฏใƒฆใƒผใ‚ถใƒผใŒๅ‰Š้™คใ•ใ‚ŒใŸๆ™‚ใซใ€ใƒฆใƒผใ‚ถใƒผใชใ—ใฎใ‚ณใƒกใƒณใƒˆใ‚’ๆฎ‹ใ™ใ“ใจใ‚’ๅฏ่ƒฝใซใ™ใ‚‹ใŸใ‚ใงใ™ใ€‚(่ฆ็ด„ by Notion โ€ฆ


#RailsTips 81ๆ—ฅ็›ฎใงใฏไปฅๅ‰ไฝœๆˆใ—ใŸ owned_by? ใ‚’ไฝฟใฃใฆใ€ๆจฉ้™ใฎใชใ„ใƒชใƒณใ‚ฏใ‚’็™บ็”Ÿใ•ใ›ใชใ„ใ‚ˆใ†ใซใ—ใพใ™ใ€‚ #Rails ่จ˜ไบ‹ใฎใƒ“ใƒฅใƒผๆ›ดๆ–ฐ (ใƒฆใƒผใ‚ถๆจฉ้™): ๅฐๆž—็ ” Rails Tips (81) - hkobโ€™s blog hkob.hatenablog.com/entry/2024/02/โ€ฆ

hkob.hatenablog.com

่จ˜ไบ‹ใฎใƒ“ใƒฅใƒผๆ›ดๆ–ฐ (ใƒฆใƒผใ‚ถๆจฉ้™): ๅฐๆž—็ ” Rails Tips (81) - hkobโ€™s blog

Rails Tipsใฎ81ๅ›ž็›ฎใงใฏใ€ๆ‰€ๆœ‰ใ—ใชใ„ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใซๅฏพใ™ใ‚‹็ทจ้›†ใ‚„ๅ‰Š้™คใฎใƒชใƒณใ‚ฏใ‚’็™บ็”Ÿใ•ใ›ใชใ„ๆ–นๆณ•ใ‚’็ดนไป‹ใ—ใพใ—ใŸใ€‚่จ˜ไบ‹ใฎๅŸท็ญ†่€…ใ‚’ๅˆ—ใซ่ฟฝๅŠ ใ—ใ€editใจdestroyใฎใƒชใƒณใ‚ฏใฎๅ‰ใซowned_by?ใงๆจฉ้™ใ‚’็ขบ่ชใ™ใ‚‹ใ“ใจใŒใƒใ‚คใƒณใƒˆใงใ™ใ€‚ใพใŸใ€ใƒฆใƒผใ‚ถ้–ขไฟ‚ใฎๅ‡ฆ็†ใ‚’่จ˜ไบ‹ใซ้ฉ็”จใ—ใพใ—ใŸใ€‚ๆฌกๅ›žใฏใ‚ณใƒกใƒณใƒˆใซใ‚‚ใƒฆใƒผใ‚ถใ‚’่ฟฝๅŠ ใ™ใ‚‹ไบˆๅฎšใงโ€ฆ


#RailsTips 80ๆ—ฅ็›ฎใงใฏ update, destroy ใงใ‚‚ๆ‰€ๆœ‰ๆจฉใฎ็ขบ่ชใŒใงใใฆใ„ใ‚‹ใ“ใจใ‚’ใƒ†ใ‚นใƒˆใง็ขบ่ชใ—ใพใ™ใ€‚ #Rails ๆ‰€ๆœ‰ใ—ใชใ„ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใฎๅ‡ฆ็†(ใƒ†ใ‚นใƒˆใ‚’่ฟฝๅŠ ): ๅฐๆž—็ ” Rails Tips (80) - hkobโ€™s blog hkob.hatenablog.com/entry/2024/02/โ€ฆ

hkob.hatenablog.com

ๆ‰€ๆœ‰ใ—ใชใ„ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใฎๅ‡ฆ็†(ใƒ†ใ‚นใƒˆใ‚’่ฟฝๅŠ ): ๅฐๆž—็ ” Rails Tips (80) - hkobโ€™s blog

RailsTips 80ๅ›ž็›ฎใงใฏใ€ๆ‰€ๆœ‰ๆจฉใ‚’็ขบ่ชใ™ใ‚‹ใƒ†ใ‚นใƒˆใŠใ‚ˆใณๅฎŸ่ฃ…ใ‚’่กŒใ„ใพใ—ใŸใ€‚ๆ‰€ๆœ‰ใ—ใชใ„ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใซๅฏพใ™ใ‚‹editใฎๅฏพๅฟœใŒๆธˆใฟใ€updateใ‚„destroyใ‚‚ๅฏพๅฟœใŒๅฎŒไบ†ใ—ใฆใ„ใพใ™ใ€‚ใƒ†ใ‚นใƒˆใงๅฏพๅฟœใŒๆธˆใ‚“ใงใ„ใ‚‹ใ“ใจใ‚’็ขบ่ชใ—ใพใ—ใŸใ€‚ๆ˜Žๆ—ฅใฏใ“ใ‚Œใซๅˆใ‚ใ›ใฆindexใชใฉใฎๆ็”ปใ‚’ไฟฎๆญฃใ—ใพใ™ใ€‚(่ฆ็ด„ by Notion AI)


#RailsTips 79ๆ—ฅ็›ฎใงใฏ edit ใ‚ขใ‚ฏใ‚ทใƒงใƒณใซใŠใ„ใฆๆ‰€ๆœ‰ๆจฉใ‚’็ขบ่ชใ™ใ‚‹ใƒ†ใ‚นใƒˆใŠใ‚ˆใณๅฎŸ่ฃ…ใ‚’่กŒใ„ใพใ—ใŸใ€‚ #Rails ๆ‰€ๆœ‰ใ—ใชใ„ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใฎๅ‡ฆ็†: ๅฐๆž—็ ” Rails Tips (79) - hkobโ€™s blog hkob.hatenablog.com/entry/2024/02/โ€ฆ

hkob.hatenablog.com

ๆ‰€ๆœ‰ใ—ใชใ„ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใฎๅ‡ฆ็†: ๅฐๆž—็ ” Rails Tips (79) - hkobโ€™s blog

Rails Tipsใฎ79ๅ›ž็›ฎใงใฏใ€ๆ‰€ๆœ‰ใ—ใชใ„ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใซๅฏพใ™ใ‚‹็ทจ้›†ใฎๅฏพๅฟœใ‚’่กŒใ„ใพใ—ใŸใ€‚ๆ‰€ๆœ‰ใ—ใชใ„ใ‚ชใƒ–ใ‚ธใ‚งใ‚ฏใƒˆใซๅฏพใ™ใ‚‹ใ‚ขใ‚ฏใ‚ปใ‚นใ‚’้˜ฒใใŸใ‚ใ€่จ˜ไบ‹ใฎๆ‰€ๆœ‰่€…ใ‚’็ขบ่ชใ™ใ‚‹ใƒกใ‚ฝใƒƒใƒ‰ใ‚’่ฟฝๅŠ ใ—ใพใ—ใŸใ€‚ใ“ใ‚Œใซใ‚ˆใ‚Šใ€ๆ‰€ๆœ‰ๆจฉใŒใชใ„ๅ ดๅˆใซใฏใƒˆใƒƒใƒ—ใƒšใƒผใ‚ธใซใƒชใƒ€ใ‚คใƒฌใ‚ฏใƒˆใ—ใพใ™ใ€‚ใพใŸใ€ๆ‰€ๆœ‰ๆจฉใ‚’็ขบ่ชใ™ใ‚‹ใƒกใ‚ฝใƒƒใƒ‰ใฏไป–ใฎใ‚ขใ‚ฏใ‚ทใƒงใƒณใงใ‚‚ๆœ‰ๅŠนใงใ™ใŒใ€ใใฎใƒ†โ€ฆ


#RailsTips 78ๆ—ฅ็›ฎใงใฏใƒฆใƒผใ‚ถใซ้–ขใ™ใ‚‹่จ˜ไบ‹ใฎไบŒใคใฎใƒกใ‚ฝใƒƒใƒ‰ใ‚’ใƒ†ใ‚นใƒˆใƒปๅฎŸ่ฃ…ใ—ใพใ—ใŸใ€‚ใ“ใ‚Œใ‚’ไฝฟใฃใฆๆ˜Žๆ—ฅใฏ index, edit ใ‚’ไฟฎๆญฃใ—ใพใ™ใ€‚ #Rails ่จ˜ไบ‹ใƒขใƒ‡ใƒซใฎใƒ†ใ‚นใƒˆ่ฟฝๅŠ : ๅฐๆž—็ ” Rails Tips (78) - hkobโ€™s blog hkob.hatenablog.com/entry/2024/02/โ€ฆ

hkob.hatenablog.com

่จ˜ไบ‹ใƒขใƒ‡ใƒซใฎใƒ†ใ‚นใƒˆ่ฟฝๅŠ : ๅฐๆž—็ ” Rails Tips (78) - hkobโ€™s blog

Rails Tipsใฎ78ๅ›ž็›ฎใงใฏใ€่จ˜ไบ‹ใŒ็‰นๅฎšใฎใƒฆใƒผใ‚ถใƒผใฎๆ‰€ๆœ‰็‰ฉใ‹ใฉใ†ใ‹ใ‚’็ขบ่ชใ™ใ‚‹ใƒกใ‚ฝใƒƒใƒ‰owned_by?ใจใ€่จ˜ไบ‹ใ‚’ๆ›ธใ„ใŸใƒฆใƒผใ‚ถใƒผใฎๅๅ‰ใ‚’ๅ–ๅพ—ใ™ใ‚‹ใƒกใ‚ฝใƒƒใƒ‰user_nameใฎๅฎŸ่ฃ…ใจใใฎใƒ†ใ‚นใƒˆใซใคใ„ใฆ่งฃ่ชฌใ—ใฆใ„ใพใ™ใ€‚owned_by?ใƒกใ‚ฝใƒƒใƒ‰ใฏใƒฆใƒผใ‚ถใƒผIDใฎๆฏ”่ผƒใ€user_nameใƒกใ‚ฝใƒƒใƒ‰ใฏdelegateใ‚’ไฝฟ็”จใ—ใฆๅฎŸโ€ฆ


#rubyonrails use the "rename" gem to rename your rails application #RailsTips

timnan101's tweet image. #rubyonrails use the &quot;rename&quot; gem to rename your rails application #RailsTips

#RailsTips ๐ŸŒธ Do you know you can use `๐˜ƒ๐—ฎ๐—น๐—ถ๐—ฑ๐—ฎ๐˜๐—ฒ๐˜€_๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฎ๐—ฟ๐—ถ๐˜€๐—ผ๐—ป_๐—ผ๐—ณ` with Rails 7.0 that provides a way to easily validate comparisons with another value, proc, or attribute? Have a look - #RubyOnRails ๐Ÿงต(1/2)

rishipi's tweet image. #RailsTips ๐ŸŒธ

Do you know you can use `๐˜ƒ๐—ฎ๐—น๐—ถ๐—ฑ๐—ฎ๐˜๐—ฒ๐˜€_๐—ฐ๐—ผ๐—บ๐—ฝ๐—ฎ๐—ฟ๐—ถ๐˜€๐—ผ๐—ป_๐—ผ๐—ณ` with Rails 7.0 that provides a way to easily validate comparisons with another value, proc, or attribute?

Have a look - 

#RubyOnRails ๐Ÿงต(1/2)

#RailsTips๐ŸŒธ Do you know you can use `invert_where` with Rails 7.0 to invert an entire where clause instead of manually applying conditions? Have a look - #RubyOnRails

rishipi's tweet image. #RailsTips๐ŸŒธ

Do you know you can use `invert_where` with Rails 7.0 to invert an entire where clause instead of manually applying conditions?

Have a look - 

#RubyOnRails

#rubyonrails use the source method to output the source code of a method to the rails console #RailsTips

timnan101's tweet image. #rubyonrails use the source method to output the source code of a method to the rails console #RailsTips

#rubyonrails Use the helper object to access view helpers in the rails console #RailsTips

timnan101's tweet image. #rubyonrails Use the helper object to access view helpers in the rails console #RailsTips

#rubyonrails with_option method gives us a way to factor out common options in a series of method calls. #RailsTips

timnan101's tweet image. #rubyonrails with_option method gives us a way to factor out common options in a series of method calls.
#RailsTips

#RailsTips ๐Ÿ’๐Ÿปโ€โ™‚๏ธ We can generate the HTTP Authorization header directly using the "HttpAuthentication::Basic" module #RubyOnRails

prathamesh2_'s tweet image. #RailsTips ๐Ÿ’๐Ÿปโ€โ™‚๏ธ

We can generate the HTTP Authorization header directly using the &quot;HttpAuthentication::Basic&quot; module

#RubyOnRails

#RailsTips Use "ActiveRecord::Type::Boolean.new.deserialize" to map user input to Ruby booleans #RubyOnRails

prathamesh2_'s tweet image. #RailsTips

Use &quot;ActiveRecord::Type::Boolean.new.deserialize&quot; to map user input to Ruby booleans

#RubyOnRails

#RailsTips ๐ŸŒธ Do you know how to prevent deletion of records in Rails? Have a look - #RubyOnRails credits - @stevepolitodsgn

rishipi's tweet image. #RailsTips ๐ŸŒธ

Do you know how to prevent deletion of records in Rails?

Have a look - 

#RubyOnRails 

credits - @stevepolitodsgn

#rubyonrails use rails stats to generate the number of classes, lines, methods your controllers, models, mailers and helpers are using #RailsTips

timnan101's tweet image. #rubyonrails use rails stats to generate the number of classes, lines,  methods your controllers, models, mailers and helpers are using #RailsTips

#RailsTips `rails db:migrate:redo` reverts last migration and runs it again. Shortcut for rolling back last migration and running it again in one command. Also takes a `STEP` environment variable which rolls back and migrates STEP count migrations. #RubyOnRails

prathamesh2_'s tweet image. #RailsTips

`rails db:migrate:redo` reverts last migration and runs it again. 

Shortcut for rolling back last migration and running it again in one command.

Also takes a `STEP` environment variable which rolls back and migrates STEP count migrations.

#RubyOnRails
prathamesh2_'s tweet image. #RailsTips

`rails db:migrate:redo` reverts last migration and runs it again. 

Shortcut for rolling back last migration and running it again in one command.

Also takes a `STEP` environment variable which rolls back and migrates STEP count migrations.

#RubyOnRails

#RubyonRails provides an easy way to compare Date, DateTime, Time, and TimeWithZone using before? and after? methods. #RailsTips

timnan101's tweet image. #RubyonRails provides an easy way to compare Date, DateTime, Time, and TimeWithZone using before? and after? methods. #RailsTips

#rubyonrails use rails db:system:change to change your database #RailsTips

timnan101's tweet image. #rubyonrails use rails db:system:change to change your database #RailsTips

#RailsTips Use `Object#presence` to get the object value if present or nil if not present. Helps avoid a conditional to check if the value is present and then get the value. #RubyOnRails

prathamesh2_'s tweet image. #RailsTips 

Use `Object#presence` to get the object value if present or nil if not present. Helps avoid a conditional to check if the value is present and then get the value.

#RubyOnRails

#RailsTips Use `change_column_default` in migrations to manage default values of columns #RubyOnRails

prathamesh2_'s tweet image. #RailsTips

Use `change_column_default` in migrations to manage default values of columns

#RubyOnRails

#RailsTips Want to see column names of a model in rails console without opening the database console? Use `Model.column_names` #rubyonrails

prathamesh2_'s tweet image. #RailsTips

Want to see column names of a model in rails console without opening the database console? Use `Model.column_names`

#rubyonrails

#RailsTips ๐ŸŒธ Do you know how to enqueue jobs quickly with Sidekiqโ€™s bulk features? Advantages - โ€ข Minimises round trips to Redis โ€ข Less complex Ruby objects & thus less memory Checkout next tweet for more info ๐Ÿ˜Š credits - @andycroll #RubyOnRails

rishipi's tweet image. #RailsTips ๐ŸŒธ

Do you know how to enqueue jobs quickly with Sidekiqโ€™s bulk features?

Advantages - 
โ€ข Minimises round trips to Redis
โ€ข Less complex Ruby objects &amp;amp; thus less memory

Checkout next tweet for more info ๐Ÿ˜Š

credits - @andycroll 

#RubyOnRails

#rubyonrails use rails db:prepare to create, seed and migrate your Rails database. #RailsTips

timnan101's tweet image. #rubyonrails use rails db:prepare to create, seed and migrate your Rails database. #RailsTips

#rubyonrails use to_sql and explain methods to analyze SQL queries generated by ActiveRecord #RailsTips

timnan101's tweet image. #rubyonrails use to_sql and explain methods to analyze SQL queries generated by ActiveRecord #RailsTips

#RubyTips #RailsTips Handy numerical methods you can use on daily basis in comparison statements in #Ruby โœจ #RubyOnRails #100DaysOfCode #DEVCommunity #Rails #100daysofcoding #100dayschallenge #CodeNewbies

rishipi's tweet image. #RubyTips #RailsTips

Handy numerical methods you can use on daily basis in comparison statements in #Ruby โœจ

#RubyOnRails #100DaysOfCode #DEVCommunity #Rails #100daysofcoding #100dayschallenge #CodeNewbies

Loading...

Something went wrong.


Something went wrong.


United States Trends