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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:57:48+00:00 2026-06-10T04:57:48+00:00

I cannot use the destroy method on an object using Rails 3.2.6 This is

  • 0

I cannot use the destroy method on an object using Rails 3.2.6
This is my code. @checkin finds an object, I checked.

@checkin = Checkin.where("user_id = ? AND event_id = ?", current_user.id, params[:event_id])

    if @checkin.destroy
      render :json => {:results => @checkin}
    else 
      render :json => {:errors => @checkin.errors.full_messages}, status: 422
    end

I get the error:

wrong number of arguments (0 for 1)

UPDATE

This is the stack trace:

activerecord (3.2.6) lib/active_record/relation.rb:378:in `destroy'
actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.6) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.6) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.6) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.6) lib/active_support/callbacks.rb:414:in `_run__2516945162825430073__process_action__3384959627746267634__callbacks'
activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.6) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.6) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.6) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `block in instrument'

Update 2 (tried in console)

@checkin = Checkin.where("user_id = ? AND event_id = ?", 46, 1)
  Checkin Load (0.3ms)  SELECT "checkins".* FROM "checkins" WHERE (user_id = 46 AND event_id = 1)
 => [#<Checkin id: 1, user_id: 46, event_id: 1, created_at: "2012-08-15 14:14:56", updated_at: "2012-08-15 18:18:40">]

ruby-1.9.2-p290 :009 > @checkin.destroy
ArgumentError: wrong number of arguments (0 for 1)
    from /Users/dkrusenstrahle/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.6/lib/active_record/relation.rb:378:in `destroy'
    from (irb):9
    from /Users/dkrusenstrahle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
    from /Users/dkrusenstrahle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
    from /Users/dkrusenstrahle/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
  • 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-06-10T04:57:49+00:00Added an answer on June 10, 2026 at 4:57 am

    Hi where always gives you array and array on’t have destroy method, Active record object has destroy method, to destroy this

    @checkin = Checkin.where("user_id = ? AND event_id = ?", 46, 1).first
    @checkin.destroy if @checkin
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I cannot use AsEnumerable() on DataTable, I'm using C# 3 but I'm just targeting
I cannot use the Ctrl + F and Ctrl + H in my SQL
I see that we cannot use if not exists in the create virtual table
So apparently you cannot use the virtual modifier with the override modifier. virtual -
It looks like you cannot use a helper in a controller even if both
I am aware you cannot use an initialiser list for an array. However I
Rather odd problem in that I cannot use the data variable (the information returned
Is it true that you cannot use COM Interop to expose COM properties? Everything
Can someone explain to me why I cannot use document.getElementById('id').value inside of a function?
I want to use stub entities but it seems I cannot use TryGetObjectStateEntry without

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.