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 1062709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:40:09+00:00 2026-05-16T18:40:09+00:00

This is the code I have at the end a the create method in

  • 0

This is the code I have at the end a the create method in

Notes controller

  def create
    @note = Note.new(params[:note])
    @note.user_id = current_user.id
    respond_to do |format|
      if @note.save
        flash[:success] = 'Note was created.'
        # @note.note_type is "Temp" at this point
        if @note.note_type == "Temp"
          p "passed first test"
          redirect_to :controller => :categories, :action => :add_category, :note_id => @note.id, :category => 'temp category'
        else
          format.html { redirect_to(@note) }
          format.xml  { render :xml => @note, :status => :created, :location => @note }
        end
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @note.errors, :status => :unprocessable_entity }
      end
    end
  end

Categories controller

def add_category
    p "in add_category"
end

When it runs, I get the following error. Line 80, where the trace begins, is the respond_to do |format| line:

NoMethodError in NotesController#create 
undefined method `call' for nil:NilClass
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:175:in `respond'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:173:in `each'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:173:in `respond'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/mime_responds.rb:107:in `respond_to'
/Users/benhartney/rails_projects/note_taker/app/controllers/notes_controller.rb:80:in `create'

I’ve got no idea how to start debugging this error. The console shows the output line “passed first test” from the create action in the Notes controller, but not the “in add_category” output line from the add_category action in the Categories controller. I’m using Rails 2.3.5. Any help would be greatly appreciated. Thanks for reading.

  • 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-16T18:40:09+00:00Added an answer on May 16, 2026 at 6:40 pm

    The respond_to method requires you to specify at least one format on the Responder object passed into its block. In the code-path creating your exception, you just call redirect_to, the responder MIME-type preference list is empty, and Rails ends up trying to call the call method on the (non-existent) block for the (non-existent) first type preference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: def setVelocity (x, y, yaw) setVelocity (Command2d.new(x,y,yaw)) end def setVelocity
Say I have code like this: class Car def test_drive!; end end class AssemblyLine
I have this code in the end of link button click: Response.ContentType = application/zip;
Say I have this code: #import <UIKit/UIKit.h> @interface MyView : UIView @end @implementation MyView
i have this code, and need help with the logic end. I would like
I have a situation like this: start(); <Some code> end(); I want start() function
I have this code JSONObject event = new JSONObject(); Bundle bundle = new Bundle();
this is function.php of a wordpress theme that NOD32 says this code have a
I've used this code to have a like btn on my site: <iframe src=http://www.facebook.com/plugins/like.php?href=URL_OF_YOUR_WEBSITE&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=80&amp
Currently I have this code: <?php echo '<meta name=robots content=noindex>'; $arr = json_decode(file_get_contents(http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json),true);

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.