Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2016
    Posts
    12
    Thanks
    5
    Thanked 0 Times in 0 Posts

    wrong number of arguments(2 for 1)

    Code:
     puts "enter paragraph"
    asdf = gets.chomp
    puts "words to redact"
    redact = gets.chomp
    obscure = redact.split
    words = asdf.split
    words.each{ |word|
    if word.include?(/#{obscure}/, "REDACTED")
    else
        puts "#{word}"
    end
    }
    Hey guys, just having some issues with the following code, and hoping i could get a little help with it.
    essentially i want it to take a paragraph of text, then filter out any words within a string entered by the user.
    im getting an error "wrong number of arguments(2 for 1)"

  2. #2
    New to the CF scene
    Join Date
    Apr 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    new (ActiveRecord::Base) - APIdock here is a little explanation of the new function. The crucial part - "pass a hash with key names matching the associated table column name". Instead of @cust = Customer.new(params[:firstName], params[:lastName]) you should have @cust = Customer.new(:firstName => params[:firstName], :lastName => params[:lastName]). This should do the trick.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •