Created
February 1, 2013 22:53
-
-
Save anithri/4694736 to your computer and use it in GitHub Desktop.
active_record model generator template
Inserted comments to help keep models organized
This file contains hidden or 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
<% module_namespacing do -%> | |
class <%= class_name %> < <%= parent_class_name.classify %> | |
#extends | |
#includes | |
#security | |
<% if !accessible_attributes.empty? -%> | |
attr_accessible <%= accessible_attributes.map {|a| ":#{a.name}" }.sort.join(', ') %> | |
<% else -%> | |
# attr_accessible :title, :body | |
<% end -%> | |
#relationships | |
<% attributes.select {|attr| attr.reference? }.each do |attribute| -%> | |
belongs_to :<%= attribute.name %> | |
<% end -%> | |
# callbacks | |
# scopes | |
# additional config | |
# class methods | |
# public instance methods | |
# protected instance methods | |
protected | |
# private instance methods | |
private | |
end | |
<% end -%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
goes in lib/templates/active_record/model