Skip to content

Instantly share code, notes, and snippets.

@shcyiza
Created October 31, 2017 20:16
Show Gist options
  • Save shcyiza/bcb036baef5737f17d997053771a271c to your computer and use it in GitHub Desktop.
Save shcyiza/bcb036baef5737f17d997053771a271c to your computer and use it in GitHub Desktop.
respond
def create
@club = Club.new(club_params)
respond_to do |format|
if @club.save
format.html { redirect_to @club, notice: 'Club was successfully created.' }
format.json { render :show, status: :created, location: @club }
else
format.html { render :new }
format.json { render json: @club.errors, status: :unprocessable_entity }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment