Git Product home page Git Product logo

Comments (5)

luizkowalski avatar luizkowalski commented on May 26, 2024 1

ah so "namespace/model" is a valid class parameter then

from factory_bot.

composerinteralia avatar composerinteralia commented on May 26, 2024

That's happening because of a call to camelize

class_name.to_s.camelize.constantize
. It might be tricky to handle that without breaking other cases (we could maybe skip camelize if there are already capital letters? But it's bound to break something for somebody). The only workaround at the moment is continuing to use the contant instead of a string 😢.

from factory_bot.

luizkowalski avatar luizkowalski commented on May 26, 2024

I see the problem...out of curiosity, why is camelize being called anyway? According to the docs you can either pass the class name as String or the class itself. In both cases to_s.constantize should be sufficient, no? What are other people doing that require a call to camelize?

from factory_bot.

composerinteralia avatar composerinteralia commented on May 26, 2024

"namespace/model".camelize => "Namespace::Model"

from factory_bot.

luizkowalski avatar luizkowalski commented on May 26, 2024

I understand that our use case might be too specific and it's not worth updating the library to solve an edge case like this.
If you think there is something of value here, it is fine otherwise, I think this can be closed.

I appreciate the help!

from factory_bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.