mabouchalkha / foodinspectors

Frontend for food inspectors
https://foodinspector.herokuapp.com
1 stars 0 forks source link

ExtendedEntity - Allow the user to add any attributes to entity #30

Open cindoum opened 9 years ago

cindoum commented 9 years ago

A system like lims ExtendedProperty could be somthing really usefull in our application.

Use case => We have a model product wich contain:

Imagine than exova subscribe to our application. Exova usually stock the color of a product. If we dont have an attribute 'color' on the model Product, they just cant do it.

They go on setting => product. they add an extended property 'color'. so now, every product of exova can now have that attribut, they can filter by it, search by it etc... That with elastic search is a killer feature it think!

@mabouchalkha what do you think?

mabouchalkha commented 9 years ago

i 100% agree with that

cindoum commented 9 years ago

I think that should be part of the beta version as it can be a plus that other inventory software doesnt have!

@mabouchalkha, beta or in a latest release?

mabouchalkha commented 9 years ago

any idea if it's difficult to implement this feature?

cindoum commented 9 years ago

Not that much. we need to decide wich entity will be 'extendable' and add a relation table to that entity...

then we will need a way to display those attributs on the page. Kind of extendedProperty viewer...

a week or less (not a full time of course)

mabouchalkha commented 9 years ago

ok let's do it in the 1.0.0

cindoum commented 9 years ago

I dont mid handle this as ive work quite a lot on this feature on the lims

cindoum commented 9 years ago

I started looking at it yesterday, and i am going to wrap this feature in a gem.

It is not a bigstep to add and it will split this functionnaly in his separate git.

What i want is to be able to add to any model something like class user has_xtended end

and then do User.xtended => [{:name => 'color'}] and u = User.first u .xtended.attribut, that will return an array of object like {value: 'blue', type: 'string', name: 'color'}

mabouchalkha commented 9 years ago

nice, component like this should be on public repo open source

cindoum commented 9 years ago

yes it will be! (maybe not for the first version cause it might not be beautifull on first try :D)

cindoum commented 9 years ago

Started something there => https://github.com/cindoum/rails_eav_test

cindoum commented 9 years ago

@mabouchalkha i think i will go with https://github.com/kostyantyn/hydra_attribute for now as i need more time to think about how to make our own gem.

mabouchalkha commented 9 years ago

ok no probleme

mabouchalkha commented 9 years ago

but i think we should resolve this #17 before, @cindoum what do yo think?

cindoum commented 9 years ago

Yes it would be better