Sha256: 9053eaf4e42780702182b55b8320c4ea2c74b27ca51829c226d36f8baf5d15e5

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

class <%= class_name %> < ActiveRecord::Base
<% if distributed -%>
  include RestfulX::UUIDHelper
<% end -%>
<% for model in belongs_tos -%>
  belongs_to :<%= model %>
<% end -%>
<% for model in has_ones -%>
  has_one :<%= model %>
<% end -%>
<% for model in has_manies -%>
  has_many :<%= model %>, :dependent => :destroy
<% end -%>
<% for model in polymorphic -%>
  belongs_to :<%= model %>, :polymorphic => true
<% end -%>
<% if has_many_through.size > 0 -%>
<% has_many_through.each do |k,v| %>
  has_many :<%= k %>
  has_many :<%= v %>, :through => :<%= k %>
<% end -%>
<% end -%>
<% if tree_model.size > 0 -%>
  acts_as_category
<% end -%>
<% if attachment_field.size > 0 -%>
<% if RxSettings.attachment_plugin == 'paperclip' -%>
  # paperclip examples:
  #   http://github.com/thoughtbot/paperclip/tree/master
  has_attached_file :<%= attachment_field[0] %>,
    :styles => { :medium => "600x480>", :thumb  => "100x100#" }
    
  def attachment_url
    <%= attachment_field[0] %>.url(:original)
  end
<% elsif RxSettings.attachment_plugin == 'attachment_fu' -%>
  # attachment_fu examples:
  #   http://github.com/technoweenie/attachment_fu/blob/ab1e4f7b0b9de85e0c9decf061d2ef5c1dc0feaa/README#L56-69
  has_attachment
  
  def attachment_url
    "" # FIX ME
  end
<% end -%>
<% end -%>
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
captproton-restfulx-1.2.3 rails_generators/rx_scaffold/templates/model.rb.erb
dima-restfulx-1.2.2 rails_generators/rx_scaffold/templates/model.rb.erb
dima-restfulx-1.2.3 rails_generators/rx_scaffold/templates/model.rb.erb
restfulx-1.2.3 rails_generators/rx_scaffold/templates/model.rb.erb
restfulx-1.2.2 rails_generators/rx_scaffold/templates/model.rb.erb