lib/generators/buildybuild/cms/cms_generator.rb in buildybuild-1.0.0 vs lib/generators/buildybuild/cms/cms_generator.rb in buildybuild-1.1.0
- old
+ new
@@ -24,11 +24,11 @@
template("cms_show_view.html.haml", "app/views/#{file_names}/show.html.haml")
template("cms_form_partial.html.haml", "app/views/#{file_names}/_form.html.haml")
end
def add_routes
- insert_into_file "config/routes.rb", generated_routes, before: /end\n*$/
+ insert_into_file "config/routes.rb", generated_routes, before: /^end\n*$/
end
private
def generated_routes
@@ -40,11 +40,10 @@
get "/:slug/edit", to: "pages#edit", as: :edit_slug
put "/:slug", to: "pages#update", as: :slug
post "/:slug", to: "pages#destroy", as: :slug\n)
end
-
def file_name
model_name.underscore
end
def file_names
@@ -59,9 +58,13 @@
file_name.pluralize.camelize
end
def table_name
klasses.downcase
+ end
+
+ def table_names
+ klasses.pluralize.underscore
end
def controller_name
"#{file_name.pluralize}Controller".camelize
end