Sha256: 52a3feb5d978b949c8d519c3ccdefb916503b24e134c5839efd37f6e77609b38

Contents?: true

Size: 575 Bytes

Versions: 10

Compression:

Stored size: 575 Bytes

Contents

<%- first_attribute = attributes.first -%>
class View<%= plural_class_name %>Controller < ApplicationController

	def index
    @<%= plural_name %> = <%= class_name %>.page(params[:search], params[:page]) 
  end

  def show
		if <%= class_name %>.find_by_<%= first_attribute.name %>(params[:filename]) == nil
			@<%= singular_name %> = <%= class_name %>.find(:first)
			render :file => "#{RAILS_ROOT}/public/404.html", :layout => false, :status => 404
		else
			@<%= singular_name %> = <%= class_name %>.find_by_<%= first_attribute.name %>(params[:filename])
		end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dust-generators-0.2.8 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.2.6 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.2.5 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.2.4 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.2.3 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.2.2 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.2.1 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.2.0 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.1.9 rails_generators/dust_scaffold/templates/view_controller.rb
dust-generators-0.1.8 rails_generators/dust_scaffold/templates/view_controller.rb