Sha256: 8239b9d0fd27fca69c460b23d370dc29c73eba4e86c7c47e51cadd4ba2c1b8ca

Contents?: true

Size: 638 Bytes

Versions: 7

Compression:

Stored size: 638 Bytes

Contents

class <%=module_name_formatted.camelize%>Controller < ApplicationController

  respond_to :html, :json
  before_action :load_<%=module_name_formatted.singularize%>, :only => [:show]

  def index
    @<%=module_name_formatted%> = <%=module_name_formatted.singularize.camelize%>.ordered.paginate(:page => params[:page])
    respond_with @<%=module_name_formatted%>
  end

  def show
    respond_with @<%=module_name_formatted.singularize%>
  end

private

  def load_<%=module_name_formatted.singularize%>
    @<%=module_name_formatted.singularize%> = <%=module_name_formatted.singularize.camelize%>.find_by!(:id => params[:id])
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tb_core-1.3.10 lib/generators/spud/templates/controller.rb.erb
tb_core-1.3.9 lib/generators/spud/templates/controller.rb.erb
tb_core-1.3.7 lib/generators/spud/templates/controller.rb.erb
tb_core-1.3.6 lib/generators/spud/templates/controller.rb.erb
tb_core-1.3.5 lib/generators/spud/templates/controller.rb.erb
tb_core-1.3.4 lib/generators/spud/templates/controller.rb.erb
tb_core-1.3.3 lib/generators/spud/templates/controller.rb.erb