Well, previouse article I had talked about Keyword Arguments Feature in Ruby 2.0. now we can apply keyword arguments in Rails4.
FINDERS
old-style finders are deprecated
- Rails3:
1
|
|
Warning: Calling #find(:all) is deprecated. Please call #all directly instead. You have also used finder options. Please build s scope instead of using finder options.
- Rails4:
1
|
|
Dynamic finder that return collections are deprecated
- Rails3:
1 2 |
|
Warning: This dynamic method is deprecated. Please use e.g Post.where(…).all instead.
- Rails4:
1 2 |
|
FIND_BY
- Rails3:
1 2 |
|
- Rails4:
1 2 |
|
FIND_BY WITH HASH
allows dynamic input more easily
- Rails4:
1 2 3 4 |
|
FIND_OR_*
dynamic finders that create new objects are deprecated
- Rails3:
1 2 |
|
Warning: This dinamic method is deprecated. Please use e.g Post.find_or_initialize_by(name: ‘foo’) instead.
Warning: This dinamic method is deprecated. Please use e.g Post.find_or_create_by(name: ‘foo’) instead.
- Rails4:
1 2 |
|
So far so good, let upgrade to Rails4 then refactor ActiveRecord Finder together. :)