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

survey update bug #139

Merged
merged 1 commit into from Jun 17, 2011
Merged

survey update bug #139

merged 1 commit into from Jun 17, 2011

Conversation

ignu
Copy link
Contributor

@ignu ignu commented May 12, 2011

stop survey titles from appending '1' to itself when calling update attributes

(also removed extra whitespace... i tend to do that when i open files)

@yoon
Copy link
Member

yoon commented Jun 16, 2011

The test passes with the existing code when I write it this way:

it "should not adjust the title when updating itself" do
original = Survey.new(:title => "Foo")
original.save.should be_true
original.update_attributes(:updated_at => Time.now)
original.title.should == "Foo"
end

My question is - what is the use case for re-assigning the title attribute?

@ignu
Copy link
Contributor Author

ignu commented Jun 17, 2011

What is the use case for appending "1" to the value of a string if it hasn't changed?

My question is - what is the use case for re-assigning the title attribute?

To let rails controllers do what they do. I'm working an admin controller for surveys for a project.

@yoon
Copy link
Member

yoon commented Jun 17, 2011

That isn't our use case... the use case is if someone re-imports a survey (it happens a lot) or imports a survey of the same name. How do you know which survey is which? We automatically append an increasing integer in order to differentiate surveys.

I agree that this is a bug, but the test is testing something that I'm curious about. I rewrite the test, updating some other attribute of the survey, and the bug did not appear. The bug only appears when you specifically re-assign the title attribute. I wanted to write the test in such a way that it demonstrates the motivation, not only the bug.

yoon pushed a commit that referenced this pull request Jun 17, 2011
@yoon yoon merged commit e8617e2 into NUBIC:rails3 Jun 17, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants