Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3722184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:48:44+00:00 2026-05-19T05:48:44+00:00

Possible Duplicate: Weird “406 not acceptable” error I’ve been stuck on this ALL DAY!

  • 0

Possible Duplicate:
Weird “406 not acceptable” error

I’ve been stuck on this ALL DAY! In my rails 3 app I have a “new” page for Studies and an “edit” page. each of these pages has the same partials to add multiple Publications to a Study. In my edit page, updating the page via .js works fine, but in studies/new, when I create a new Publication I get a 406 Not Acceptable error. My Publications/create action looks like this:

def create
  @publication = Publication.new(params[:publication])
  @publication.display_number = @publication.get_display_number(session[:study_id])
  @publication.save
  @secondary_publications = Publication.find(:all, :order => 'display_number ASC', :conditions => {:is_primary => false, :study_id => session[:study_id]})  

 respond_to do |format|
  if @publication.save
        format.js {
            render :update do |page|
                page.replace_html 'secondary_publication_table', :partial=>'publications/table' 
            end
        }
  else
    format.html { render :action => "new" }
    format.xml  { render :xml => @publication.errors, :status => :unprocessable_entity }
  end
  end
  end

I’ve tried various ways I could find of setting the content-type (yet I don’t have to do this on other pages…) such as

render :update, :content-type => "text/javascript" do |page|

but I can’t get anything to change the content type from text/html when I call the action. Help?

Thanks in advance!

Edit:
the code submitted in the form looks like this:

<%= nested_form_for @publication, :remote => true, :html=>{:id=>'secondary_pub_form'} do |f| %>
<%= f.text_field :title %>
<%= f.text_field :author, :size => 12 %>
<%= f.text_field :country, :size => 10 %>
<%= f.text_field :year, :size => 6 %>

… etc…

 <% end %>

the “nested_form_for” is a plugin that I’m using.. this setup has worked on other pages in the same way (using this plugin, loading a partial, etc)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:48:46+00:00Added an answer on May 19, 2026 at 5:48 am

    It’s not clear to me what the intent is here. Do you mean to always reject .html and .xml? Maybe you want:

    respond_to do |format|
      format.html { render :action => "new" }
      format.xml  { render :xml => @publication.errors, :status => :unprocessable_entity }
      format.js do
        if @publication.save
          render :update do |page|
            page.replace_html 'secondary_publication_table', :partial=>'publications/table' 
          end
        else
          # handle failing AJAX request somehow
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Weird “406 not acceptable” error following code generate a 406 Not Acceptable
Possible Duplicate: How does this work? Weird Towers of Hanoi Solution While surfing Google,
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
Possible Duplicate: What Ruby IDE do you prefer? I've generally been doing stuff on
Possible Duplicate: Weird Java Boxing Recently I saw a presentation where was the following
Possible Duplicate: 500 - An error has occurred! DB function reports no errors when
Possible Duplicate: Weird Java Boxing Hi, Can somebody explain why the last print returns
Possible Duplicate: How do you give a C# Auto-Property a default value? Hi all:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.