Code Monkey home page Code Monkey logo

rails-concern's Introduction

rails-concern

Database

Minimal Example

db

For the code challenge we require to have some sort of facts table in order to store this attribute exceptions.

The table DataAttributes contains a primary key and a name for each attribute. This table can be used for any other model that will require the same attribute.

The table Partner will be each partner. The table Customer contains all the non custom attributes.

For the customer case the CustomerFacts will contain a primary key and 2 foreign keys ( customer and the partner for the sql query) and one foreign key to get the attribute that we want to pick. The value column will tell us what is the string value of that attribute.

For other models we need to add other tables such as the customerfacts in order to have custom attributes per model.


For the ruby logic.

As for the ruby code I created a concern where it includes a set of attribute into each of the model and a function to check if the values of each attribute are present/not blank.

the concern was included in the model.

rails-concern's People

Contributors

pcardosolei avatar

Watchers

 avatar

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.