Sha256: 67190e7f819d640d68c899d99d60ff797914d772a907f42e6171a41ecf149a3a

Contents?: true

Size: 839 Bytes

Versions: 4

Compression:

Stored size: 839 Bytes

Contents

<% module_namespacing do -%>
class <%= class_name %> < <%= parent_class_name.classify %>
<% attributes.select(&:reference?).each do |attribute| -%>
  belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %>
<% end -%>
<% attributes.select(&:token?).each do |attribute| -%>
  has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
<% end -%>
<% if attributes.any?(&:password_digest?) -%>
  has_secure_password
<% end -%>

  def self.live_record_whitelisted_attributes(<%= class_name.underscore %>, current_user)
	  # Add attributes to this array that you would like current_user to have access to.
	  # Defaults to empty array, thereby blocking everything by default, only unless explicitly stated here so.
	  []
  end
end
<% end -%>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
live_record-0.0.4 lib/live_record/generators/templates/model.rb.rb
live_record-0.0.3 lib/live_record/generators/templates/model.rb.rb
live_record-0.0.2 lib/live_record/generators/templates/model.rb.rb
live_record-0.0.1 lib/live_record/generators/templates/model.rb.rb