ruby on rails - Shortcuts in ActiveRecord? -
Are any of the railroad shortcuts 'active records' that are able to search with the value of the field?
For example, suppose I have a 'user' that can be active or passive, is there a good way to activate the user? Or do I need to do User.find_by_active (1)
Is this field also applicable to which there may be many different values, such as State Column? Like tickets Open, Ticket. Close?
If the active attribute is a boolean column in the database, Code> User.active? and return it to true or incorrect based on the value of boolean.
This will not work in the case of a State Colony. Although you can create methods for user models such as ...
Diff open? True if self.state == "open" the end def closed? Not open? End
Comments
Post a Comment