Sha256: fd58d9f6145ddd06a6ba6770f08b42ab67f7cb72451251ab75e454f71f03aec9

Contents?: true

Size: 725 Bytes

Versions: 20

Compression:

Stored size: 725 Bytes

Contents

class <%= class_name %> < ActiveRecord::Base
<%= " set_table_name :#{table_name}\n" if table_name -%>
attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
 <% model_attributes.each do |attribute| %>
   <%= "#validates_presence_of :#{attribute.name}" %>
        <% if attribute.type==:integer -%>
    <%="#validates_numericality_of :#{attribute.name}"%>
       <% end -%>
      <% if attribute.type==:string -%>
    <%= "#validates_length_of :#{attribute.name} ,:maximum=>255" %>
       <% end -%>
  <% end -%>

        #Schema Information
    <% model_attributes.each do |attribute| %>
      #<%= attribute.name %>:<%=attribute.type %>
     <% end %>
#scopes
#default_scope order('created_at DESC')
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
thesilverspoon-0.0.22 lib/templates/model.rb
thesilverspoon-0.0.21 lib/templates/model.rb
thesilverspoon-0.0.20 lib/templates/model.rb
thesilverspoon-0.0.19 lib/templates/model.rb
thesilverspoon-0.0.18 lib/templates/model.rb
thesilverspoon-0.0.17 lib/templates/model.rb
thesilverspoon-0.0.16 lib/templates/model.rb
thesilverspoon-0.0.15 lib/templates/model.rb
thesilverspoon-0.0.14 lib/templates/model.rb
thesilverspoon-0.0.13 lib/templates/model.rb
thesilverspoon-0.0.12 lib/templates/model.rb
thesilverspoon-0.0.11 lib/templates/model.rb
thesilverspoon-0.0.10 lib/templates/model.rb
thesilverspoon-0.0.9 lib/templates/model.rb
thesilverspoon-0.0.8 lib/templates/model.rb
thesilverspoon-0.0.7 lib/templates/model.rb
thesilverspoon-0.0.6 lib/templates/model.rb
thesilverspoon-0.0.5 lib/templates/model.rb
thesilverspoon-0.0.4 lib/templates/model.rb
thesilverspoon-0.0.3 lib/templates/model.rb