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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:45:02+00:00 2026-05-15T22:45:02+00:00

This method works on my local machine but does not work on my remote

  • 0

This method works on my local machine but does not work on my remote server. It is looking for a block, but I do not know ‘where’ or ‘how’ to place it.

def generate_csv
  if params[:print_envelopes]
    @signups = CardBatch.find(params[:id]).card_signups.each.reject { |a| a.envelope? }
    @filename = 'envelopes.csv'
    csv_string = FasterCSV.generate do |csv|
      csv << ["first name, last name, street address, city, state, zip code"]
      @signups.each do |signup|
        csv << [signup.first_name, signup.last_name, signup.street_address_1, signup.city, signup.state, signup.zip_code]
        signup.envelope = true
        signup.save
      end
    end
  elsif params[:print_cards]
    @signups = CardBatch.find(params[:id]).card_signups.reject { |a| a.card? }
    @filename = 'cards.csv'
    csv_string = FasterCSV.generate do |csv|
      csv << ["name", "expiration date", "card number"]
      @signups.each do |signup|
        csv << [signup.full_name, signup.exp_date.strftime('%m/%y'), signup.formatted_card_number] if card?
        signup.card = true
        signup.save
      end
    end
  end

  send_data(csv_string,
    :type => 'text/csv; charset=utf-8; header=present',
    :filename => @filename)
end

The error:

Processing Admin::CardBatchesController#generate_csv (for 173.161.167.41 at 2010-07-21 07:19:47)     [POST]
  Parameters: {"action"=>"generate_csv",     "authenticity_token"=>"OcDII/t8ZleZxRBpISi+Giw+4MAV2Cjjq8bdixJJ+I8=", "id"=>"4", "controller"=>"admin/card_batches", "print_envelopes"=>"print envelopes"}

LocalJumpError (no block given):
  vendor/gems/mislav-will_paginate-2.3.11/lib/will_paginate/finder.rb:170:in `method_missing'
  app/controllers/admin/card_batches_controller.rb:62:in `generate_csv'
  haml (2.2.2) [v] rails/./lib/sass/plugin/rails.rb:19:in `process'
  lib/flash_session_cookie_middleware.rb:14:in `call'
  vendor/gems/hoptoad_notifier-2.2.2/lib/hoptoad_notifier/rack.rb:27:in `call'

** [Hoptoad] Failure: Net::HTTPClientError
** [Hoptoad] Environment Info: [Ruby: 1.8.6] [Rails: 2.3.3] [Env: production]
** [Hoptoad] Response from Hoptoad: 
<?xml version="1.0" encoding="UTF-8"?> 
<errors>
<error>No project exists with the given API key.</error>
</errors>
Rendering /data/HQ_Channel2/releases/20100721141730/public/500.html (500 Internal Server Error)

Update

If will_paginate is called anywhere within this controller’s focus, it will run this function.

Finder.rb around line 170

  def method_missing_with_paginate(method, *args) #:nodoc:
    # did somebody tried to paginate? if not, let them be
    unless method.to_s.index('paginate') == 0
      if block_given?
        return method_missing_without_paginate(method, *args) { |*a| yield(*a) }
      else
        return method_missing_without_paginate(method, *args) 
      end
    end

    # paginate finders are really just find_* with limit and offset
    finder = method.to_s.sub('paginate', 'find')
    finder.sub!('find', 'find_all') if finder.index('find_by_') == 0

    options = args.pop
    raise ArgumentError, 'parameter hash expected' unless options.respond_to? :symbolize_keys
    options = options.dup
    options[:finder] = finder
    args << options

    paginate(*args) { |*a| yield(*a) if block_given? }
  end

And for some reason this function, and my function written above do not match up. If I can solve that, then this ticket can be closed.

  • 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-15T22:45:02+00:00Added an answer on May 15, 2026 at 10:45 pm

    The method_missing_without_paginate method comes from alias_method_chain. will_paginate adds behavior before the default behavior of method_missing in Active Record.

    I’m guessing that the error is on this line(that this is line 62)

    @signups = CardBatch.find(params[:id]).card_signups.each.reject { |a| a.envelope? }
    

    the key bit: card_signups.each.reject {

    You probably have 1.8.7 on your local machine. In 1.8.7, each without a block returns an Enumerator object that you can iterate over. This was backported from 1.9 and is awesome.

    But, 1.8.6 doesn’t do that. In 1.8.6, each requires a block to work. You are ok though, because you don’t need the each in this expression.

    Replace that line with

    @signups = CardBatch.find(params[:id]).card_signups.reject { |a| a.envelope? }
    

    and it should work.

    Another thing to think about would be how big card_signups will be. You might want to use :conditions to tell the db to do the filtering for you.

    Assuming you are using a boolean column named envelope, it would look like this:

    @signups = CardBatch.find(params[:id]).card_signups.all :conditions => {:envelope=>false} 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer What I think you're talking about is client side templating.… May 16, 2026 at 4:33 pm
  • Editorial Team
    Editorial Team added an answer try to use ValidationGroup for validation controls and submit control. May 16, 2026 at 4:33 pm
  • Editorial Team
    Editorial Team added an answer protected void layout(int width, int height) { setExtent(Math.min(width, getPreferredWidth()), Math.min(height,… May 16, 2026 at 4:33 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This does NOT work: Sub X() Dim A As Access.Application Set A = CreateObject(Access.Application)
I'm unhappy with the rule about variable scope in a try block not being
I'm coding some c# against Active Directory and have tried endlessly to get this
I have a pretty simple local service that I'm trying to bind to my
I'm trying to make a subclass of NSCalendar, but without much luck. I've tried
I've just finished cruising the Google search results that contain all the email rants
I have the following UDP broadcast listener running as a static component in a
I am having difficulty deploying RIA services/Silverlight 3 to a staging environment. Here is
I'm a big fan of the ruby way. However today it got in my
How do people here actually deploy a C# application?? I see a couple of

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.