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

Base record hash setter inconsistent behaviour +temporary fix #25

Closed
KieranP opened this issue Sep 5, 2011 · 2 comments
Closed

Base record hash setter inconsistent behaviour +temporary fix #25

KieranP opened this issue Sep 5, 2011 · 2 comments

Comments

@KieranP
Copy link

KieranP commented Sep 5, 2011

Xeroizer 0.3.5

https://github.com/waynerobinson/xeroizer/blob/master/lib/xeroizer/record/base.rb#L53

invoice[:date] = Date.today
=> nil

The problem it seems, when compared to the working build method, is that []= is forgetting to convert the attribute setter string to a symbol.

If we change the line

self.send("#{attribute}=", value)

to

self.send("#{attribute}=".to_sym, value)

it appears to fix the issue:

invoice[:date] = Date.today 
=> Mon, 05 Sep 2011

I've had reports that it'll work sometimes, and not others. We're not sure of the exact cause at this stage.

Could be caused because of a loop we use:

new_attrs.each { |k,v| invoice[k] = v }

(side-note: a merge method would be great)

@waynerobinson
Copy link
Owner

Hi Kieran

That seems reasonable to me. Do you mind submitting as a pull request?

Also, happy to look at a pull request with a merge implementation.

Cheers

Wayne

On 5 September 2011 13:51, KieranP <
reply@reply.github.com>wrote:

Xeroizer 0.3.5

https://github.com/waynerobinson/xeroizer/blob/master/lib/xeroizer/record/base.rb#L53

invoice[:date] = Date.today
=> nil

The problem it seems, when compared to the working build method, is that
[]= is forgetting to convert the attribute setter string to a symbol.

If we change the line

self.send("#{attribute}=", value)

to

self.send("#{attribute}=".to_sym, value)

it appears to fix the issue:

invoice[:date] = Date.today
=> Mon, 05 Sep 2011

I've had reports that it'll work sometimes, and not others. We're not sure
of the exact cause at this stage.

Could be caused because of a loop we use:

new_attrs.each { |k,v| invoice[k] = v }

(side-note: a merge method would be great)

Reply to this email directly or view it on GitHub:
#25

@waynerobinson
Copy link
Owner

This has now been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants