Sha256: 8eff06ad50f9b9d3e19769f1eda8c3ae89ad6ab10feca4ca7bf9ecfaf9362a53

Contents?: true

Size: 996 Bytes

Versions: 11

Compression:

Stored size: 996 Bytes

Contents

module Refinery
  module <%= namespacing %>
    module Admin
      class <%= class_name.pluralize %>Controller < ::Refinery::AdminController

        crudify :'refinery/<%= namespacing.underscore %>/<%= singular_name %>'<% if (title = attributes.detect { |a| a.type.to_s =~ /string|text/ }).present? and title.name != 'title' -%>,
                :title_attribute => '<%= title.name %>'<% end -%><% if plural_name == singular_name -%>,
                :redirect_to_url => :refinery_<%= namespacing.underscore %>_admin_<%= singular_name %>_index_path<% end %>

        private

        # Only allow a trusted parameter "white list" through.
        def <%= "#{singular_table_name}_params" %>
          <%- if attributes_names.empty? -%>
          params[:<%= singular_table_name %>]
          <%- else -%>
          params.require(:<%= singular_table_name %>).permit(<%= attributes.map { |attr| ":#{attr.column_name}" }.join(', ') %>)
          <%- end -%>
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
refinerycms-core-4.0.3 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-4.0.2 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-4.0.1 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-3.0.6 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-4.0.0 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-3.0.5 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-3.0.4 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-3.0.3 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-3.0.2 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-3.0.1 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb
refinerycms-core-3.0.0 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb