rails if else assignment one liner
status = (condition) ? "active" : "inactive"
Explanation:
1. condition
: Replace this with the actual condition you want to check.
2. The ternary operator ? :
is used for inline if-else statements.
3. If the condition is true, the value after ?
is assigned to status
("active" in this case).
4. If the condition is false, the value after :
is assigned to status
("inactive" in this case).