Explore tweets tagged as #RailsTips
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
7
19
113
@MyBuddyAndrew
Andrew Hodson
2 years
#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
Tweet media one
5
6
59
@MIbtehajNasar
M Ibtehaj Nasar
2 months
๐Ÿ’Ž Rails tip of the day:. To eliminate N+1 query woes, always preload associations with `includes`:. Save those DB hits! ๐Ÿš€.#RubyOnRails #RailsTips
Tweet media one
0
0
0
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
2
5
39
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
2
5
47
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
1
4
31
@_rshiva
Shiva
2 years
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
Tweet media one
0
1
6
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
4
1
21
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
3
0
8
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
1
1
24
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
0
5
23
@ernepazzo1212
๐Ÿ‡จ๐Ÿ‡บ Erne Pazzo ๐Ÿ‡จ๐Ÿ‡บ
1 year
@RubyCademy
RubyCademy
1 year
โœจ RAILS PRO TIPS โœจ. Take the habit of using pick(*column_names) instead of pluck(*column_names).first โœจ๐Ÿ’ซ. #ruby #rubyonrails
Tweet media one
0
0
2
@rishipi
Rishi Pithadiya
2 years
#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
Tweet media one
0
0
11
@lucascaton
Lucas Caton
10 months
1
0
0
@vickyonit
Vignesh Rajendran
2 years
#railstips. Interesting way to use `find_or_create_by` when you want to find by one parameter but create with additional parameters.
Tweet media one
1
0
0
@kotogavr
Anna Gavrilova
1 year
Add this snippet to auto-fix Ruby code style with RuboCop right after generating files (scaffold, models, etc.) in Rails. #RailsTips
Tweet media one
0
1
16
@siaw23
Emmanuel (sub to my Rails YouTube)
13 days
Soft launching my first ever product! I mentioned I was working on this a few weeks ago, well here we are now! Happy to share this with you all ;).
4
8
41
@mafulprayoga
Maful
2 years
Just added a small but mighty improvement to the tabs navigation on @railstips_dev - now you can effortlessly drag to scroll. Improving the user experience, one step at a time ๐Ÿš€
1
0
0
@itsAndL03
Ayoub Lkebch
2 years
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
Tweet media one
0
1
3