Comments (4)
I got around this (temporarily, hopefully) by doing the following:
p.after_build { |proposal| proposal.type = 'Session' }
from factory_bot.
Use this instead:
f.add_attribute :type, type
from factory_bot.
That seemed to do the trick. What is the method "type" used for anyway?
from factory_bot.
type is a reserved column in Rails used for single-table-inheritance. Type is also a method on Object that returns the class: http://ruby-doc.org/core/classes/Object.html#M000349
So you have to set the type attribute indirectly via add_attribute.
from factory_bot.
Related Issues (20)
- Factory with explicitly specified `parent` has broken associations HOT 1
- Warnings are displayed when factory bot is used with Ruby 3.3.0 HOT 4
- Move stub strategy into factory_bot_rails
- Lint: multiple factory definitions that make the same object
- has_many relations
- Zeal/Dash docset
- Ad hoc sequences in create_list
- Pass context to initialize_with
- Expose which keys were overridden by the user HOT 2
- Factory before(:create) called AFTER model after_create HOT 1
- FactoryBot introduces ActiveSupport monkey patching to Hashes
- Question: Why `Evaluator` class is marked as a `@api private` if its instance is part of `to_create` API?
- Please consider bringing back the old readme-style documentation HOT 2
- Add `factory_bot.before_factory_run` instrumentation event
- Fix shape variations with attribute assigner
- Do not overwrite the dafault value
- Add find_or_create_by Method
- Feature request: attribute scoped sequence
- `require 'factory_bot'` fails with latest ActiveSupport gem (7.2.0)
- Factory Bot does not work with the latest activesupport release HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from factory_bot.