Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model create not respecting schema #178

Closed
u89012 opened this issue Jun 18, 2020 · 3 comments
Closed

Model create not respecting schema #178

u89012 opened this issue Jun 18, 2020 · 3 comments
Labels

Comments

@u89012
Copy link

u89012 commented Jun 18, 2020

The following queries fine but doesn't create, could be a bug I think. Can someone please confirm?

module Products
  class Listing
    include Clear::Model
    self.schema = "products"
    self.table = "listings"

    column id : Int64, primary: true, presence: false
    column title : String?
  end
end

# respects schema, works fine
Products::Listing.query.each { |a| puts a.title }

# FAILS tries insert into "listings" without the schema prefix
a = Products::Listing.create(title: "iPhone")
@anykeyh anykeyh added the bug label Jun 20, 2020
@anykeyh
Copy link
Owner

anykeyh commented Jun 20, 2020

Yes, it's a bug.
You might trick the system by naming your table products.listings.

@u89012
Copy link
Author

u89012 commented Jun 24, 2020

Thank you for confirming. That's too bad I can't do that as I'm working with a legacy database. I thought I saw references to self.schema in the code when I looked up on how to include the schema information for the model. Any chance this will be fixed soon?

@anykeyh
Copy link
Owner

anykeyh commented Nov 21, 2020

You can use the v0.9 branch, this has been fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants