38

This is the original post:

I use ember 2.9.1 and ember data 2.9.0.

I have a simple model say 'users' which has 'name' and 'address' fields. When i query the model using findAll('user'), the data from server is right. But when i try to get the actual data(using toArray) from the recordArray returned, the data i get array of classes.

i.e., if i have two users, then i get an array of classes instead of the actual data i expect like([{name:"user1", address: "address1"},{name:"user2", address: "address2"}]) to give to the template.

Am i doing it right?

Edited post:

I use ember 2.9.1 and ember data 2.9.0.

I have a simple model named user which has name and address fields. When I query the model using store.findAll('user'), the data from server is right. But when I try to get the actual data(using toArray) from the recordArray returned, the returned data is an array of classes.

i.e., if I have two user s, then I get an array of classes instead of the actual data I expect like ( [{name:"user1", address: "address1"},{name:"user2", address: "address2"}] ) to give to the template.

What am I doing wrong?

Original versus suggested changes:

  1. say 'users' which - named user which
  2. 'name' and 'address' - name and address
  3. Am i doing it right? - What am I doing wrong?
  4. i - I (in many places)
  5. all variables and code formatted with `` (in many places)

I believe that all the changes are acceptable. Is my assumption right? If so, how should I convince the OP? Can I point the OP to this answer?

14
  • 33
    If the OP wants to insist on their broken english, let them. No point trying to convince them
    – Pekka
    Commented Dec 26, 2016 at 8:02
  • 2
    I have left a comment on the question, so that the OP of the question can comment here if they would like to discuss it further. Commented Dec 27, 2016 at 3:37
  • @YowE3K [{name:"user1", address: "address1"},{name:"user2", address: "address2"}] - not repeated twice in the edit version, it was my mistake so updated question. In ember findAll method will be called from store. Actually, my intention is to get comments from Moderators for this edit since OP got disappointed due to this edit. Commented Dec 27, 2016 at 4:53
  • By default in ember-data defining model name convention is singular so Renaming 'users' to 'user'. is required change. only then we can use findAll('user') Note: we can make it work for users too but it requires to define inflector configuration Commented Dec 27, 2016 at 14:12
  • 6
    @Pekka웃: we will have to let some broken English through - editors are not other people's autocorrect - but I think "let them" is too permissive. We want readable posts here, and posters who roll back good edits need to be dissuaded.
    – halfer
    Commented Dec 27, 2016 at 14:23
  • 7
    @halfer: By "let them" I assume Pekka means not trying to force edits on them that they're just going to keep rolling back, and having to involve a moderator in such petty squabbles. There's a much more effective way of dissuading such posters, and that is to downvote their posts. Either they wise up from the downvotes (and the resulting post ban, if it comes to that), or they can take their ball and go home.
    – BoltClock
    Commented Dec 27, 2016 at 15:35
  • @BoltClock, yes, I'd mostly agree with that. I've also found that after explaining why an earlier edit was good, posters will permit me to roll back again to the good edit without their carrying on an edit war.
    – halfer
    Commented Dec 27, 2016 at 15:38
  • 1
    @halfer: Don't you just love it when others cooperate?
    – BoltClock
    Commented Dec 27, 2016 at 15:39
  • I don't agree with the back-ticks (`) for a line of code, use code blocks instead (new line with four spaces).
    – user692942
    Commented Dec 28, 2016 at 11:37
  • @Lankymart: I don't necessarily agree that the text you're referring to is "a line of code". Commented Dec 28, 2016 at 14:29
  • @LightnessRacesinOrbit it's JSON if anything it's multiple lines of code.
    – user692942
    Commented Dec 28, 2016 at 16:28
  • @Lankymart: As pointed out elsewhere, JSON is not code. Commented Dec 28, 2016 at 16:41
  • @LightnessRacesinOrbit splitting hairs but ok...personally though I prefer JSON to include syntax highlighting which is lost with back-ticks.
    – user692942
    Commented Dec 28, 2016 at 16:49
  • 1
    @Lankymart: Hmm, does Markdown highlight JSON? Sold :) Commented Dec 28, 2016 at 16:54

3 Answers 3

22

Original versus suggested changes:

  1. say 'users' which - named user which

This is not only unnecessary, but changes the meaning of the post, "breaking" it by renaming one of the OP's models.

  1. 'name' and 'address' - name and address

Code formatting or quotation marks are helpful here, okay, if only marginally.

  1. Am i doing it right? - What am I doing wrong?

Other than the capitalisation of "i" (see below), this is an extremely minor change that doesn't really improve the sentence. I may have been tempted to rewrite the sentence in the same way, whilst I was in there performing other changes. But I wouldn't hang on it.

  1. i - I (in many places)

This is important. It's sad to see that the original author is actually insisting upon using "i": it's incorrect, ugly and comes across as lazy "text speak".

  1. all variables and code formatted with `` (in many places)

Good work here too.

Overall, your edit was good, and if it were a suggested edit then I probably would have accepted it, with a minor improvement to put the model name "user" back the way you found it.

10
  • 2
    By default in ember-data defining model name convention is singular so Renaming 'users' to 'user'. is required change. only then we can use findAll('user') Note: we can make it work for users too but it requires to define inflector configuration Commented Dec 27, 2016 at 14:11
  • 1
    @halfer: same way* Commented Dec 27, 2016 at 14:31
  • 4
    @kumkanillam: That sort of detail would form part of an answer, not of an edit to the question. Commented Dec 27, 2016 at 14:32
  • 5
    At first I thought the 'users'/'user' change was inappropriate too, but then I noticed that the OP had written "findAll('user')" later in the question, which makes it extremely likely that the earlier occurrence of 'user' was just a typo.
    – duplode
    Commented Dec 27, 2016 at 16:16
  • 2
    @duplode: Still, we should let the OP make those sorts of corrections. You don't know whether you're making it better or worse, and you don't know whether you're masking the problem being reported. Such a change goes beyond the remit of third-party post edits. Commented Dec 27, 2016 at 17:29
  • 2
    @LightnessRacesinOrbit In general, yes; sometimes, however, it is clear that the issue reported by the OP has nothing to do with the (presumed) typo (e.g. the OP is reporting some misbehaviour from a piece of code which wouldn't even compile without the typo being fixed). In such cases, I believe it may be okay to edit, though an informative edit summary and a heads-up to the OP in a comment would be appropriate (neither of which, by the way, seem to have been provided by the editor here).
    – duplode
    Commented Dec 27, 2016 at 17:51
  • Point 5. Wouldn't encourage back-ticks for a line of code, should use a code-block. Back-ticks don't provide syntax hightlighting and code-blocks as they require their own line are far cleaner.
    – user692942
    Commented Dec 28, 2016 at 11:39
  • @Lankymart: Would agree in general. This seems like a borderline case, not only because the quoted section is not actually code. Commented Dec 28, 2016 at 14:25
  • @LightnessRacesinOrbit how is it not code?, it's a snippet of JSON.
    – user692942
    Commented Dec 28, 2016 at 16:27
  • 1
    @Lankymart: That makes it data, not code. JSON is a data definition language, not a programming language. If the snippet were larger I'd certainly agree that it deserved its own "code" block anyway. As this one stands, I feel it's borderline. I don't disagree with your suggestion though. Commented Dec 28, 2016 at 16:40
4
  1. Renaming 'users' to 'user'.

Why change the code sample he provided to replicate his issue?

  1. 'name' and 'address' - name and address

This helped readability.

  1. Am i doing it right? - What am I doing wrong?

Correcting 'i' to 'I' helped. Changing his question to "What am I doing wrong?", while correct, was unnecessary and might have made him defensive. An editor should be more tactful.

  1. i - I (in many places)

Correcting 'i' to 'I' helped.

  1. all variables and code formatted with `` (in many places)

This helped readability.

5
  • 2
    By default in ember data defining model name convention is singular so Renaming 'users' to 'user'. is required change. only then we can use findAll('user') Note: we can make it work for users too but it requires to define inflector configuration Commented Dec 27, 2016 at 14:10
  • Ah. Then that's fine. But I would also recommend using the comments to explain why you're editing the code sample. That's what the community usually does on other questions.
    – Zesty
    Commented Dec 27, 2016 at 14:12
  • 1
    Oh sure, editor missed commenting the reason part but then its default behavior every ember-data developer must be familiar with. OP himself might be aware of this because he used findAll('user') not findAll('users') Commented Dec 27, 2016 at 14:23
  • 3
    @kumkanillam: the user/users thing sounds like a radical change such that, if you fix it, it may mask the source of a problem. I don't know if that applies here, but in general code in posts should be left unedited, perhaps with the exception of readability/indentation.
    – halfer
    Commented Dec 27, 2016 at 14:27
  • 1
    @halfer we trust that experts know what they are doing, and that their edits only serve to prevent distractions from the main point of the question. The change was inconsequential and it actually aligns with OP own words mentioned later on. The change was on the text of the question, the question doesn't have "code".
    – Braiam
    Commented Dec 27, 2016 at 14:39
-36

Firstly, people looking at this problem might not currently have a clear idea what had happened.

I asked this question. I really got some useful responses from Sri and Kumkanillam. That was great. And I don't think they just tried to answer my question without understanding it.

Then comes this guy Lux. He edited the post. When I saw it, I did have three mistakes which are

  1. Not using the code block for

    [{name:"user1", address: "address1"},{name:"user2", address: "address2"}]
    
  2. ...the data i get array of classes should be actually ...the data i get **is an** array of classes

  3. i to be replaced with I, which i usually won't do (used to have editors which have autocorrect feature - maybe Stack Overflow can do it too). It is yet an unsolved story. Read more about it here.

But other than that I did not find the other replacements even this useful. I asked him about this. Then it started and Kumkanillam started supporting him.

Then it all went like "fight for your right" kind of thing which I thought was less useful to Stack Overflow too. Later all tried to do is get this topic off my head which they did not let me to.

Is this what a moderator supposed to do, to kill people with their mistakes?

Sorry, if I have hurt you people (Kumkanillam and Lux). But do think about the usefulness of this community being from a common user point of view (who wants to find and give answers). All that common user now got is spending two days of less useful time fighting for something not necessary. And some less useful Stack Overflow points being reduced for each down votes they had given.

30
  • 31
    The article linked doesn't say that "I" can be capitalized or not at personal discretion. Like it or not, English usage long since made the very firm determination that it must be capitalized. You are free, as the author of the post, to insist on deliberately using bad grammar, but don't kid yourself: it's bad grammar. Commented Dec 27, 2016 at 7:07
  • 4
    In regards to the downvotes and any additional "drama" from the post, it's probably best to delete the question, because the community seems to be in agreement that the question isn't useful for future readers, since it was resolved by correcting a typo in the code. (This will also reverse the lost reputation from the downvotes). Commented Dec 27, 2016 at 7:17
  • 21
    Are you seriously trying to argue about the capitalization of "I"? Get real.
    – BoltClock
    Commented Dec 27, 2016 at 7:40
  • 20
    "If you are not comfortable with the idea of your contributions being collaboratively edited by other trusted users, this may not be the site for you."
    – Braiam
    Commented Dec 27, 2016 at 10:02
  • 6
    Semi-OT: First thing I've seen of this post was Is this what a moderator supposed to do(to kill people. ... Not a good start to convince people to not downvote you.
    – deviantfan
    Commented Dec 27, 2016 at 10:03
  • 9
    The edits were useful in the sense that they formatted the question in a way that's more easily understandable. The code blocks are used to highlight text that are found in code and differentiate it from explanatory text. He fixed grammar so people would understand it better. It's not of disrespect but to make the question more clear. Commented Dec 27, 2016 at 12:06
  • 1
    When you talk about "moderators", note that the site is mostly community-moderated, and moderators often don't have time to edit. Your editors in this case were not moderators, as far as I can see.
    – halfer
    Commented Dec 27, 2016 at 14:29
  • 4
    Note that I don't generally downvote for poor English, since it is a basic unfairness that people have to learn English to communicate here. However, I tend to regard lower-case personal pronouns in the same way as txtspk - they feel like deliberate and wilful flouting of the communication conventions we try to agree on in order to exchange ideas more efficiently. Rolling back good edits is in a worse category, so if you have acquired any downvotes here, they seem to be deserved. Remember that editors over a certain rep do not get points for their edit work.
    – halfer
    Commented Dec 27, 2016 at 14:34
  • 4
    @venkateshR: don't take it personally. I edited your Meta answer to explicitly indicate that you should be fine with people editing your answers. There was a lot to edit, but your posts on the main site can still have great value. Just write great posts, and don't make a fuss if someone improves your material. No, don't delete your posts if you don't like someone's edits. That's the equivalent of taking your ball home because you lost a game. Why not just enjoy having played instead?
    – halfer
    Commented Dec 27, 2016 at 15:26
  • 5
    Of course, some edits are subjective, Ventakesh - I agree. If the only disagreement is whether I am "halfer" or "Halfer" then it is not worth editing (names usually get a capital letter, but perhaps not usernames on the internet). But others are important. The word "won't" has an apostrophe in it, and it is misspelled without it. Sentence construction is important i.e. every sentence should be able to stand on its own. Code formatting should not be applied to non-code. Brackets generally need a space prefix. And so on...
    – halfer
    Commented Dec 27, 2016 at 15:45
  • 2
    Don't worry about the downvotes. You got a bit of a "tarring and feathering" this time around, but a few good posts will recover the lost points in no time at all!
    – halfer
    Commented Dec 27, 2016 at 15:47
  • 2
    @venkateshR Everyone on here knows that a majority of people don't have English as native tongue, so if you misspell or use incorrect grammar that's fine as long as you do your best. But if there's some things that are incorrect then people might edit. Sometimes when people edit they also fix stuff that they believe is better but is just subjective. That's fine as long as they don't ruin the meaning of your post or make it unclear. Commented Dec 27, 2016 at 15:50
  • 3
    @venkateshR I do however agree that the edit on this question was mostly unnecessary but it had a couple valid fixes. I had the same problem when I was new and also got in a 'edit war' with another user. It takes some time to realize that the questions you post here are not yours, but the communities. When another user makes an edit it has to be reviewed before it's accepted. If it is accepted then the community has agreed upon the edit. You can disagree and argument for your case but sometimes you have to accept that the community believes different than you. Commented Dec 27, 2016 at 15:55
  • 8
    Not being fluent in English is a different thing, but I'm shocked to learn that you deliberately didn't bother to capitalize the 'i's out of pure laziness! You came to the community to ask for help with YOUR problem, and you can't be bothered to take time to press the Shift key, so SOMEBODY ELSE has to edit YOUR question so that YOU can get an answer to YOUR problem? On top of that, you're actually upset that the editor helped you? Please also understand that this site is a knowledge repository that thousands of people will be benefiting on from every question over time, so grammar matters.
    – Zesty
    Commented Dec 27, 2016 at 17:54
  • 5
    Let me suggest a different angle. If you believe the edit "had both valid fixes and unnecessary edits", why you rolled back both the valid changes and the unnecessary ones, as opposed to just the ones you deemed unnecessary?
    – duplode
    Commented Dec 27, 2016 at 18:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .