lib/generators/buildybuild/cms/templates/cms_controller.rb in buildybuild-0.0.1 vs lib/generators/buildybuild/cms/templates/cms_controller.rb in buildybuild-1.0.0
- old
+ new
@@ -1,22 +1,13 @@
class <%= controller_name %> < ApplicationController
expose(:<%= file_name.pluralize %>)
expose(:<%= file_name %>, finder: :find_by_slug, finder_parameter: :slug)
expose(:new_<%= file_name %>, model: <%= klass %>)
- expose(:slug) { params[:slug] }
# Move this to the ApplicationController if you want to have
# the navigation in your Application Layout
expose(:<%= file_name%>_slugs ) { <%= klass %>.select(:slug).map(&:slug) }
-
- def show
- if template_exists? "<%= file_names %>/#{slug.underscore}"
- render slug.underscore
- else
- render "show"
- end
- end
def create
if new_<%= file_name %>.save
redirect_to slug_path(new_<%= file_name %>.slug)
else