lib/generators/dust/scaffold/templates/view_controller.rb in dust-generators-0.2.6 vs lib/generators/dust/scaffold/templates/view_controller.rb in dust-generators-0.2.8

- old
+ new

@@ -1,17 +1,17 @@ <%- first_attribute = model_attributes.first -%> class View<%= plural_class_name %>Controller < ApplicationController - def index + 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 + 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 \ No newline at end of file +end