class Object

Public Class Methods

fae_fields() click to toggle source

required to set the has_one associations, Fae::StaticPage will build these associations dynamically

# File lib/generators/fae/templates/models/pages_model.rb, line 6
  def self.fae_fields
    {
<% @attributes.each_with_index do |(attr, type), index| -%>
      <%= attr %>: { type: <%= type %> }<%= index + 1 != @attributes.length ? ",\n" : "\n" -%>
<% end -%>
    }
  end

end

Public Instance Methods

index() click to toggle source
# File lib/generators/fae/templates/controllers/nested_index_scaffold_controller.rb, line 13
def index
  @items = <%= class_name %>.for_fae_index
end

def edit
end

def create
  @item = <%= class_name %>.new(permitted_params)

  if @item.save
    @items = <%= class_name %>.for_fae_index
    flash[:notice] = 'Item successfully created.'
    render template: '<%= options.namespace %>/<%= plural_file_name %>/index'
  else
    render action: 'new'
  end