This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Allow scaffold/model/migration generators to accept a polymorphic modifier for references/belongs_to, for instance | |
rails g model Product supplier:references{polymorphic} | |
will generate the model with belongs_to :supplier, polymorphic: true association and appropriate migration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails Edge: Custom Flash Types | |
# | |
#Rails just got some syntactic sugar for dealing with flash messages in | |
#your controllers and views. | |
# | |
#You can now declare the following in your controllers: | |
# | |
class ApplicationController | |
add_flash_types :error, :warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Only show commit history earlier than 5 days ago: | |
git log --since=5.day.ago | |
Only show commit history older than 5 days ago: | |
git log --until=5.day.ago | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I have seen people writing something like: | |
users.collect{|u| u.tasks.size}.sum | |
# This can also be written as | |
users.sum{|u| u.tasks.size} |
NewerOlder