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

Fix issue cannot create two files of the same type, even if the name is different #80

Merged

Conversation

Gaurav0
Copy link
Contributor

@Gaurav0 Gaurav0 commented Jul 24, 2015

Fixes issue #79

@stefanpenner
Copy link
Contributor

is it possible to add a regression test?

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Jul 24, 2015

@stefanpenner Yes, done.

@stefanpenner
Copy link
Contributor

wunderbar

generateIdForRecord: function(store, type, inputProperties) {
return inputProperties.filePath.replace(/\//gi, '.');
return inputProperties.filePath.replace(/\//gi, '.') + "." + this.incrementProperty('seq');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of allowing duplicate filePath's, I think that we should delay calling store.createRecord until after we have prompted for the file name.

We should:

  • Add a build (or buildProperties) to ember-cli service.
  • Move main logic out of generate into build, leaving generate as roughly return this.store.createRecord('gistFile', this.build(type));.
  • Update addNew action in gist/controller.js to call build, then prompt, then createRecord.

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Jul 26, 2015

@rwjblue How's this?

@Gaurav0 Gaurav0 closed this Jul 26, 2015
@Gaurav0 Gaurav0 reopened this Jul 26, 2015
@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Jul 26, 2015

Above was just to get Travis to test this. Please review.

@rwjblue
Copy link
Member

rwjblue commented Jul 27, 2015

Looks good to me, thanks for working on this!

rwjblue added a commit that referenced this pull request Jul 27, 2015
…type

Fix issue cannot create two files of the same type, even if the name is different
@rwjblue rwjblue merged commit 149b1b0 into ember-cli:master Jul 27, 2015
@Gaurav0 Gaurav0 deleted the fix_cannot_create_two_files_same_type branch March 21, 2016 13:47
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

Successfully merging this pull request may close these issues.

3 participants