Top Tweets for #RubyTips
Need the smallest and biggest number fast? Ruby’s minmax returns both in one call.
#Ruby #LearnRuby #RubyTips #Coding #Arrays #PuzzlMedia
Ruby’s partition splits one array into two. The first array gets everything that matches your condition, while the second array gets the rest.
#Ruby #LearnRuby #RubyTips #Coding #LearnToCode #DeveloperTips #Arrays #PuzzlMedia
Ever heard of String#inquiry in Rails? It turns strings into objects that respond to question methods, making code more readable. Instead of status == 'active', you can write https://t.co/ft2mNO1XPZ? . Super underrated! #RubyOnRails #RubyTips #CodeCleaner

10 Useful Ruby One-Liners: Examples and Descriptions https://t.co/olLJp2dUfR #RubySnippets #RubyTips
100 Ruby on Rails Interview Questions: Answers and Tips for Developers https://t.co/ScxtyzfEj7 #RubyTips #InterviewQuestions
#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

A #RESTful controller is named for the resource it is going to operate on.
When it gets out of hands, we lose the #CRUD mapping to the resources and meaningful controller names.
An example and solution.
#rubyonrails #ruby #rubyantipatterns #programming #RubyTips #RailsTips

When a class/object wrapped within methods, it gets difficult to #test and introduce a new behavior of the underlying implementation.
We pull out such dependencies and pass them in args. Thus replacing a behavior and #testing gets easy.
#rubyonrails #ruby #RubyTips #RailsTips

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

How do I write tests for private methods?
The very first question that boggles us when we have a logic responsible to do something, encapsulated in private methods.
Here's how to fix it.
#rubyonrails #ruby #rubyantipatterns #programming #RubyTips #RailsTips #testing #tdd #bdd

When there's a blocking code that'd end up taking time before we could show any feedback to the users.
It's recommended to put it in a Job to make it async.
#performance #rubyonrails #ruby #rubyantipatterns #rubydeveloper #rubyonrailsdeveloper #programming #rubytips #railstips

A widely known yet less used principle, i.e. the Single Responsibility principle.
An example of its violation, how to fix it without breaking your application's behavior.
#rubyonrails #ruby #rubyantipatterns #rubydeveloper #rubyonrailsdeveloper #programming #rubytips #railstips

#TIL: You can override constants in your modules for your specs with stub_const("ModuleName::FOO", 5). I am working with holidays, which means I need to freeze time when it's not a holiday or - preferentially - tell my system there are no holidays. #rubytips #webdevelopment
Ruby Tip:
You can use [1].tap(&:pop) to remove the last item from an array & return the array itself instead of the removed item.
#ruby #rubytips #rubyguides
Trends for you
Most Popular Users

Elon Musk 
@elonmusk
241.5M followers

Barack Obama 
@barackobama
118.8M followers

Cristiano Ronaldo 
@cristiano
114.5M followers

Donald J. Trump 
@realdonaldtrump
111.8M followers

Narendra Modi 
@narendramodi
107.1M followers

Rihanna 
@rihanna
98.7M followers

NASA 
@nasa
92.3M followers

Justin Bieber 
@justinbieber
91.8M followers

KATY PERRY 
@katyperry
90M followers

Taylor Swift 
@taylorswift13
84M followers

Lady Gaga 
@ladygaga
75.5M followers

Virat Kohli 
@imvkohli
73.5M followers

Kim Kardashian 
@kimkardashian
70.9M followers

YouTube 
@youtube
68.8M followers

Neymar Jr 
@neymarjr
66.5M followers

Bill Gates 
@billgates
65.3M followers

Selena Gomez 
@selenagomez
63.1M followers

The Ellen Show
@theellenshow
62.2M followers

CNN 
@cnn
61.7M followers

X 
@x
60.7M followers















