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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:29:52+00:00 2026-06-11T05:29:52+00:00

I have a table which includes an integer type column named sequence, which does

  • 0

I have a table which includes an integer type column named “sequence”, which does not allow nulls. If I try to define the factory normally, FactoryGirl thinks I’m trying to set up a sequence rather than define a column name.

factory :my_table do
    sequence 1
end

# NoMethodError: undefined method `to_sym' for 1:Fixnum

How can I set this up so that FactoryGirl recognizes it as a plain column, not a FactoryGirl sequence? What if I wanted to use an actual sequence to populate the column with unique incrementing integer values? I could see potentially having the same problem with a column named ‘trait’ or ‘association’. Incidentally, I’m using factory_girl 3.3.0 and rails 3.2.8.

  • 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-11T05:29:54+00:00Added an answer on June 11, 2026 at 5:29 am

    Googling found this solution:

    factory :luggage do
      add_attribute :sequence, "12345"
    end
    

    https://groups.google.com/forum/?fromgroups=#!topic/factory_girl/OriR9gXlMZI

    If you then need to create a sequence and use it, see this cheat sheet:

    Sequences:

    # Defines a new sequence
    Factory.sequence :email do |n|
      "person#{n}@example.com" 
    end
    
    #Uses the sequence
    Factory.next :email
    # => "person1@example.com"
    
    # can also be defined inline:
    Factory.define :user do |u|
      u.sequence(:email) { |n| "persion#{n}@example.com" }
    end
    

    http://cheat.errtheblog.com/s/factory_girl

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

Sidebar

Related Questions

I have daily scheduled task that queries a table which includes column named AttemptDate
I have a table of names and addresses, which includes a postcode column. I
So I have a mySQL database with a 'users' table which includes a username,
I have a table which includes all the users video downloading history: src_ip vlan_id
I have an ORACLE table which includes the following fields: FieldA1 NUMBER(10,0) FieldA2 VARCHAR2(40
I have a table called prices which includes the closing price of stocks that
we have a database table which has around 200,000 records. which includes 3 ntext
I have table which contains double values stored in mysql database ...I need to
I have table in which I am inserting rows for employee but next time
i have a table which has many fields but i want to get count

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.