class Object
Public Instance Methods
<(%= instance_name %>_params params.require(:<%= instance_name %>).permit(<%= attributes.map { |a| ":
click to toggle source
# File lib/generators/adhoc/portfolio/templates/controller.rb, line 12 def <%= instance_name %>_params params.require(:<%= instance_name %>).permit(
create()
click to toggle source
# File lib/generators/adhoc/portfolio/templates/actions/create.rb, line 1 def create @<%= instance_name %> = <%= model_name %>.new(<%= instance_name %>_params) if @<%= instance_name %>.save redirect_to <%= item_url %>, notice: "Successfully created <%= model_name.underscore.humanize.downcase %>." else render :new end end
destroy()
click to toggle source
# File lib/generators/adhoc/portfolio/templates/actions/destroy.rb, line 1 def destroy @<%= instance_name %>.destroy redirect_to <%= items_url %>, notice: "Successfully destroyed <%= model_name.underscore.humanize.downcase %>." end
edit()
click to toggle source
# File lib/generators/adhoc/portfolio/templates/actions/edit.rb, line 1 def edit end
index()
click to toggle source
# File lib/generators/adhoc/portfolio/templates/actions/index.rb, line 1 def index @<%= instances_name %> = <
new()
click to toggle source
# File lib/generators/adhoc/portfolio/templates/actions/new.rb, line 1 def new @<%= instance_name %> = <
set_(<%= instance_name %> @<%= instance_name %> = <%= model_name %>.where(id: params[:id]).first)
click to toggle source
# File lib/generators/adhoc/portfolio/templates/controller.rb, line 8 def set_<%= instance_name %> @<%= instance_name %> = <%= model_name %>.where(id: params[:id]).first end
show()
click to toggle source
# File lib/generators/adhoc/portfolio/templates/actions/show.rb, line 1 def show end
update()
click to toggle source
# File lib/generators/adhoc/portfolio/templates/actions/update.rb, line 1 def update if @<%= instance_name %>.update_attributes(<%= instance_name %>_params) redirect_to <%= item_url %>, notice: "Successfully updated <%= model_name.underscore.humanize.downcase