module Casein
Scaffolding generated by Casein
<%= casein_get_full_version_string %>
Constants
- VERSION
- VERSION_HASH
Public Instance Methods
show()
click to toggle source
# File lib/generators/casein/scaffold/templates/controller.rb, line 14 def show @casein_page_title = 'View <%= singular_name.humanize.downcase %>' @<%= singular_name %> = <%= class_name %>.find params[:id] end <% unless @read_only %> def new @casein_page_title = 'Add a new <%= singular_name.humanize.downcase %>' @<%= singular_name %> = <%= class_name %>.new end def create @<%= singular_name %> = <%= class_name %>.new <%= singular_name %>_params if @<%= singular_name %>.save flash[:notice] = '<%= singular_name.humanize.capitalize %> created' redirect_to casein_<%= @plural_route %>_path else flash.now[:warning] = 'There were problems when trying to create a new <%= singular_name.humanize.downcase %>' render action: :new end end
update()
click to toggle source
# File lib/generators/casein/scaffold/templates/controller.rb, line 36 def update @casein_page_title = 'Update <%= singular_name.humanize.downcase %>' @<%= singular_name %> = <%= class_name %>.find params[:id] if @<%= singular_name %>.update <%= singular_name %>_params flash[:notice] = '<%= singular_name.humanize.capitalize %> has been updated' redirect_to casein_<%= @plural_route %>_path else flash.now[:warning] = 'There were problems when trying to update this <%= singular_name.humanize.downcase %>' render action: :show end