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

Can't squash on multiple fields #14

Closed
ehowe opened this issue Feb 15, 2013 · 3 comments
Closed

Can't squash on multiple fields #14

ehowe opened this issue Feb 15, 2013 · 3 comments
Assignees

Comments

@ehowe
Copy link
Contributor

ehowe commented Feb 15, 2013

Consider the following

class Blah < Cistern::Model
  attribute :fanart, aliases: "Images", squash: "fanart"
  attribute :boxart, aliases: "Images", squash: "boxart"
end

When creating this model with a hash of:

{"Images" => {"fanart" => { stuff }, "boxart" => { stuff } }

The boxart attribute will end up with the contents of

{"fanart" => { stuff }, "boxart" => { stuff } }

The last attribute that you squash when you are trying to squash on the same alias more than once, will always end up with the complete squashed hash, earlier defined attributes end up nil.

@ehowe
Copy link
Contributor Author

ehowe commented Feb 15, 2013

For what it's worth, the issue is with the block at https://github.com/lanej/cistern/blob/master/lib/cistern/attributes.rb#L71-L74

It only gets called for the last squash when there is more than one using the same alias, but I can't for the life of me figure out why.

@ghost ghost assigned lanej Jul 29, 2013
@manuelmeurer
Copy link
Contributor

Is this the same as #23? Can you try if it still happens with master?

@lanej
Copy link
Owner

lanej commented Sep 27, 2013

Fixed by #23 .

@lanej lanej closed this as completed Sep 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants