Update the create
action as below:
def create ... respond_to do |format| if @reservation.save format.html do redirect_to '/' end format.json { render json: @reservation.to_json } else format.html { render 'new'} ## Specify the format in which you are rendering "new" page format.json { render json: @reservation.errors } ## You might want to specify a json format as well end end end
You are using respond_to
method but anot specifying the format in which a new
page is rendered. Hence, the error ActionController::UnknownFormat
.
Related Posts:
- Rails 4 RoutingError: No Route Matches
- PG::ConnectionBad – could not connect to server: Connection refused
- Rails: I installed Ruby, now “bundle install” doesn’t work
- Get underlined text with Markdown
- What is the meaning of *nix?
- Get underlined text with Markdown
- What does the “map” method do in Ruby?
- How to write a switch statement in Ruby
- Rails 5 ActionController::InvalidAuthenticityToken error
- what does ? ? mean in ruby
- How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite?
- What does %w(array) mean?
- How to use “gets” and “gets.chomp” in Ruby
- Getting a substring in Ruby by x number of chars
- How to check whether a string contains a substring in Ruby
- Ruby: How to install a specific version of a ruby gem?
- ruby operator “=~” [duplicate]
- What is attr_accessor in Ruby?
- What does ||= (or-equals) mean in Ruby?
- How to read lines of a file in Ruby
- Array to Hash Ruby
- Ruby: undefined method `[]’ for nil:NilClass when trying to get Enumerator on an Array of Hashes
- How to map with index in Ruby?
- Ruby equivalent for Python’s “try”?
- What does “+=” (plus equals) mean?
- How to sum array of numbers in Ruby?
- Ruby array to string conversion
- How to check if a value exists in an array in Ruby
- undefined method (NoMethodError) ruby
- Multi-Line Comments in Ruby?
- How to uninstall ruby installed by ruby-install
- Rails syntax error : unexpected keyword_ensure, expecting end-of-input
- Removing all installed Gems and starting over
- Ruby `send` vs `call` method
- What is the meaning of “do | |” in Ruby?
- RVM is not a function, selecting rubies with ‘rvm use …’ will not work
- How to delete specific characters from a string in Ruby?
- bcrypt LoadError: Cannot load such file
- Ruby: kind_of? vs. instance_of? vs. is_a?
- How to do a newline in output
- Ruby: What is the easiest way to remove the first element from an array?
- Ruby String to Date Conversion
- p vs puts in Ruby
- Determining type of an object in ruby
- Fizz Buzz in Ruby for dummies
- How to Uninstall RVM? [duplicate]
- What is the “right” way to iterate through an array in Ruby?
- What is the difference between a Process’ pid, ppid, uid, euid, gid and egid?
- Equivalent of “continue” in Ruby
- What does the Ruby method ‘to_sym’ do?
- Difference between map and collect in Ruby?
- Rails button_to vs. HTML Button Tag
- Creating and iterating a 2d array in Ruby
- What is the best way to convert an array to a hash in Ruby
- Ruby 2.0.0p0 IRB warning: “DL is deprecated, please use Fiddle”
- Getting error: dyld: Symbol not found: _clock_gettime
- Uninstall old versions of Ruby gems
- Uploading a file in Rails
- What is java interface equivalent in Ruby?
- Sort hash by key, return hash in Ruby
- Gem installation error: You have to install development tools first
- How to understand strptime vs. strftime
- How can I delete one element from an array by value
- How to break out from a ruby block?
- ERROR: While executing gem … (Gem::FilePermissionError)
- No such file or directory @ rb_sysopen ruby
- How to add to an existing hash in Ruby
- Ruby ‘require’ error: cannot load such file
- How to convert a string to lower or upper case in Ruby
- What is the canonical way to trim a string in Ruby without creating a new string?
- Difference between $stdout and STDOUT in Ruby
- No implicit conversion of String into Integer (TypeError)?
- Multi-Line Comments in Ruby?
- AJAX call returns 0
- get_template_part execute with ajax
- How to add WordPress nonces to ajax request
- PHP calling AJAX function that relies on passed PHP function values not working
- Is there a way to optimize function that is used for returning data in an ajax-call?
- Call the content of a page in AJAX in WordPress
- WordPress Ajax Data problem
- Help with shortcode in admin-ajax [closed]
- ajax_object is not defined when ajax calls the function
- Fetching the value of forms in WordPress AJAX
- How to add WP API and JS featured image attachment
- Using AJAX with Forms
- Error when posting comment form: The error is TypeError: e[h] is not a function
- videopress videos are not displayed when loading the content with ajax in a lightbox
- Add Ajax Hooks and Call from Custom Template PHP
- Output multi-steps form results in same page
- How to perform a frontend HTTP call with AJAX when plugin save the new settings?
- calling admin-ajax.php from admin-ajax.php
- If I leave out the wp_die() in the testiframe function I get the ‘0’ appended to my output. If I put it in, the page w/ iframe linked to it crashes
- How to run an ajax call in elementor editor
- 400 Bad Request – Post to admin-ajax.php
- Filtering custom posts by using checkboxes for taxonomy in an ajax loop always gives server 500 error
- ajax polling with admin-ajax.php
- Should I edit a user meta field with PUT, PATCH, or POST and WP::Editable
- My ajax request don´t work and return 0
- Use Shortcode on Custom Page
- Execute PHP code in Javascript onclick