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

Allow structs to be annotated with #[table_name="foo"] #87

Merged
merged 1 commit into from
Jan 12, 2016

Commits on Jan 12, 2016

  1. Allow structs to be annotated with #[table_name="foo"]

    This is related to #86, where we are not properly inferring the table
    name for some structs. While I do want to actually fix some of the cases
    in that issue, it's also been pointed out that we don't handle any edge
    cases for pluralization.
    
    I might improve pluralization *slightly*, but we're not going to
    maintain an actual mapping of every word as it's brittle, difficult to
    maintain, and causes bug fixes to stop people's code from compiling.
    
    Regardless of how good our inference is, we should decouple the table
    name from the struct name. This now allows specifying the table name
    with an annotation. This does not affect any public API, only
    associations which I have not made public or documented as they're still
    very prototypical.
    
    It should be noted that this *only* affects other annotations on the
    same struct. When we're processing an annotation on `Foo`, we don't
    actually have a way to go look at the annotations on `Bar` (at least not
    as far as I can tell). At this point in time, we do not directly
    reference any struct in a way that should be affected by this.
    `#[belongs_to]` comes close, but the table name is based on the
    association name, not the foreign struct that we look for.
    sgrif committed Jan 12, 2016
    Configuration menu
    Copy the full SHA
    68c403a View commit details
    Browse the repository at this point in the history