Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added shortcuts for getters/setters of table less model's attributes,…
… in the parent model
- Loading branch information
Vito Botta
committed
Jul 24, 2011
1 parent
b8943c7
commit 32b438c
Showing
6 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class ActiveRecord::Base | ||
# | ||
# | ||
# delegates method calls for unknown methods to the tableless model | ||
# | ||
def method_missing method, *args, &block | ||
self.class.tableless_models.each do |column_name| | ||
serialized_attribute = send(column_name) | ||
return serialized_attribute.send(method, *args, &block) if serialized_attribute.respond_to?(method) | ||
end | ||
|
||
super method, *args, &block | ||
end | ||
end | ||
|
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
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
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