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

Add option to have attributes with identical name #11

Open
paulepanter opened this issue Jun 27, 2013 · 5 comments
Open

Add option to have attributes with identical name #11

paulepanter opened this issue Jun 27, 2013 · 5 comments
Assignees
Labels

Comments

@paulepanter
Copy link

This is another enhencement request. (Sorry, for spamming you lately.)

Is it possible to lift the requirement, that all attribute names have to be unique? For example in a project where you have several documents with different attributes, but every document has an addressee_id or a signing_date attribute.

@kostyantyn
Copy link
Owner

Not sure if I understood you correctly. All attributes are assigned only to one entity (Product, Category, etc). Please, look at attribute name index. It allows to create attribute signing_date for each entity but they will have their own IDs.

Do you want to have one attribute signing_date and have a possibility to assign it to all entities you have (Product/Category)?

@paulepanter
Copy link
Author

Let me give another example, which I think does not work currently.

Take one entity Product with two hydra sets Car and TV, where each of them is supposed to have the hydra attribute color. But color of Car should be of backend_type text and TV should be backend_type integer.

@kostyantyn
Copy link
Owner

i've got it. it's a good idea.

I can create a separate hydra_entities table where Car and TV will be stored and attach all attributes to these entities instead of class directly. There is only one disadvantage that one additional sql query will be performed but maybe it could be cached somehow.

I'll think about the best implementation of this feature and maybe add it in the next release.

@ghost ghost assigned kostyantyn Jun 28, 2013
@paulepanter
Copy link
Author

Awesome. Thanks. Is there a road map and an (estimated) date for the next release?

@kostyantyn
Copy link
Owner

I don't know the day of the next release because I'm so busy now but i'll try to make a time and do it.

Currently, the most of code from 0.4.2 version was rewritten. That version was really slow. If you have 100 attributes, they will be loaded more than 2 seconds! and the bottleneck was ActiveRecord. So I removed it from internal purposes and now use only the database driver. As the result, models, which use hydra attributes, are loaded a little bit longer than other activerecord models. I'll provide a benchmark after release but you can test it yourself now.

Also, another important bug was fixed: you could receive corrupted data if you used more than one server in production.

About road map.
There are several helper methods which has not been migrated yet: returning dirty attributes, inspections, association methods between hydra sets and hydra attributes, etc. Also, gem doesn't work with MassAssignmentSecurity. Instead of these issues, some parts of the code are not well covered with tests.

The next release, 0.5.0, will not support Rails 4 and will be freezed for Rails 3. After release, I'll start working on version 0.6.0 and the main feature will be compatibility with rails 4.

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