Sha256: b3bd0b515282386cf221c75ba0f59c2d248ff32f19e36be107696af5eddc48d3

Contents?: true

Size: 580 Bytes

Versions: 83

Compression:

Stored size: 580 Bytes

Contents

<% collections = attributes.select {|a| a.name.match(/_id$/)}.map {|a| a.name.gsub(/_id$/, '')}.uniq -%>
class Tenon::<%= class_name.pluralize %>Controller < Tenon::ResourcesController
<% unless collections.blank? -%>
  before_filter :get_collections, :only => [:index, :edit, :update, :new, :create]
<% end -%>

<% unless collections.blank? -%>
  private
    def get_collections
<% collections.each do |c| -%>
      @<%= c.pluralize %> = <%= c.camelize %>.all
<% end -%>
    end
<% end -%>

    def resource_params
      params.require(:<%= singular_name %>).permit!
    end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
tenon-1.1.8 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.1.7 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.1.6 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.1.5 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.1.4 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.1.3 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.1.2 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.1.1 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.76 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.75 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.74 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.73 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.72 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.71 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.70 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.69 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.68 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.67 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.66 lib/generators/tenon/scaffold/templates/controller.rb
tenon-1.0.65 lib/generators/tenon/scaffold/templates/controller.rb