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

  • Home
  • SEARCH
  • 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 6162787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:42:47+00:00 2026-05-23T21:42:47+00:00

I get the following error when I call ContactUser.new: contact_user.rb:13: syntax error, unexpected ‘)’,

  • 0

I get the following error when I call ContactUser.new:

contact_user.rb:13: syntax error, unexpected ')', expecting '='
contact_user.rb:19: syntax error, unexpected kEND, expecting $end

Usually an error like this is pretty obvious, but I can’t seem to pinpoint the cause. Any help would be appreciated.

class ContactUser < ActiveRecord::Base

  include Tableless

  column :name, :string
  column :email, :string
  column :category, :string
  column :message, :text
  column :recipient, :string

  validates_presence_of :name, :email, :category, :message, :recipient

  def self.create_from_params(params={}, recipient)
    params[:message].encode!('US-ASCII', :undef => :replace) # re-encode message in US ASCII to ensure mailer works with it

    ContactUser.create(:name => params[:name], :email => params[:email], :category => params[:category], :message => params[:message], :recipient => recipient)
  end

end

module Tableless

  def self.included(base)
    base.extend(ClassMethods)
  end

  module ClassMethods

    def columns() @columns ||= []; end

    def column(name, sql_type=nil, default=nil, null=true)
      columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
    end

  end

  def save(validate=true)
    validate ? valid? : true
  end

end
  • 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-23T21:42:48+00:00Added an answer on May 23, 2026 at 9:42 pm

    Here’s your problem:

    def self.create_from_params(params={}, recipient)
    #---------------------------------^^^
    

    You’re declaring a default value for the params parameter to create_from_params but you don’t provide a default for recipient. Parameters with defaults must appear at the end of the argument list and they can’t be followed by parameters without defaults.

    This error message:

    contact_user.rb:13: syntax error, unexpected ')', expecting '='
    

    tells us that Ruby was expecting to see an equals sign for the recipient default value when it hit the closing parenthesis for the argument list.

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

Sidebar

Related Questions

I'm trying to call the SQL statement below but get the following error: System.Data.SqlClient.SqlException:
I get the following error: Fatal error: Call to undefined function getAvnet() in C:\xampp\htdocs\ems\app\controllers\queries_controller.php
When creating a new object in PHP, I get the following error message: Fatal
When I call unlink like so: unlink($_FILES['upload_file']['tmp_name']); I get the following error message: unlink():
Why do I get following error when trying to start a ruby on rails
We get the following error; The request was aborted: Could not create SSL/TLS secure
I get the following error when running my Visual Studio 2008 ASP.NET project (start
I get the following error when building my Windows Forms solution: LC.exe exited with
I get the following error when trying to run the latest Cygwin version of
I get the following error when attempting to install RubyGems . I've tried Googling

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.