Ruby on Rails
Sunday, September 13, 2015
That is all I have, The controller have nothing special all is basic and default. Well not quite, I am using
cocoon gem for the nested forms but other than that is pretty vanilla.
Thanks.
class PcpsController < ApplicationController
before_action :set_pcp, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!
def new
@pcp = Pcp.new
end
def create
@pcp = Pcp.new(pcp_params)
respond_to do |format|
if @pcp.save
format.html { redirect_to @pcp, notice: 'Pcp was successfully created.' }
format.json { render :show, status: :created, location: @pcp }
else
format.html { render :new }
format.json { render json: @pcp.errors, status: :unprocessable_entity }
end
end
end
endYou received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b35f5794-2cc4-460c-847d-4dd72e0f9928%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment