Model has Properties or Attributes?

29 views
Skip to first unread message

mistermojo

unread,
Nov 15, 2012, 9:23:02 AM11/15/12
to ged...@googlegroups.com
Hi all,

This is a little tangential follow up from Eric Ponce's earlier question. In the docs (http://geddyjs.org/documentation#models.updateProperties), model seems to have .updateProperties() but in the generated (from "geddy resource foo" etc.) and working code, it's .updateAttributes().

Which do we want to be canonical? Either way is fine, but imho, we really should be more consistent. I'm guessing it's meant to be Properties since the other methods refer to properties. Changing the code in geddy and deployed apps would require "Search and Replace". So, if a change in geddy source is done, please do a "heads up" release notes post to the google group? Cheers!

Joe Werle

unread,
Nov 15, 2012, 9:39:04 AM11/15/12
to ged...@googlegroups.com

Very good point, I've been wondering the same thing. I think a convention and coding style doc would be cool.

--
The official community discussion group.
website: geddyjs.org, source: https://github.com/mde/geddy, group: https://groups.google.com/d/forum/geddyjs?hl=en
 
 

Brent Westmoreland

unread,
Nov 15, 2012, 10:02:23 AM11/15/12
to ged...@googlegroups.com
I think our fearless leader has posted the styleguide for all of his opensource projects here:


In addition the dotfiles for jslint, etc are posted here:


+1 for properties over attributes

Joe Werle

unread,
Nov 15, 2012, 10:04:56 AM11/15/12
to ged...@googlegroups.com
+2 for an awesome timely response!

Thanks dude
werle
@josephwerle

mistermojo

unread,
Nov 15, 2012, 10:34:34 AM11/15/12
to ged...@googlegroups.com
Strangely enough, I read (and largely agreed with) that style guide even before I tried geddy. Got to that doc from here: "https://github.com/mde/geddy/wiki/Contributing-to-Geddy" while I was shopping around for a node-based framework to use. Something about the style guide made me return to geddy. The project founder(s) seemed reasonable and thoughtful. :D

Matthew Eernisse

unread,
Nov 19, 2012, 7:17:09 PM11/19/12
to ged...@googlegroups.com
Yes, this should be updateProperties. I found an old reference to updateAttributes in the example app, and have updated it. I can't find it anywhere else. Looks like the docs on the site have it right.

mistermojo

unread,
Nov 20, 2012, 2:45:53 AM11/20/12
to ged...@googlegroups.com
Well, as of 0.6.13, if you do: 

geddy scaffold thingie

The generated code in app/controllers/thingies.js still has thingie.updateAttributes(params) in the this.update section.

Uh...also, something's broken in the scaffold code. I'll file a bug.

mistermojo

unread,
Nov 20, 2012, 3:21:04 AM11/20/12
to ged...@googlegroups.com
Update: it seems it does not like thingies. I tried with blob and it works. Have filed issue on github.

Anyway, scaffold still does generate updateAttributes(params) in the controller.

Matthew Eernisse

unread,
Nov 20, 2012, 4:22:10 PM11/20/12
to ged...@googlegroups.com
LOL inflections. :)

Ugh, looks like ack doesn't know about .ejs files. A proper "grep -r" found where that's happening. I'll push a fix ASAP.

Matthew Eernisse

unread,
Nov 20, 2012, 4:25:10 PM11/20/12
to ged...@googlegroups.com
Fix is in v0.6.14.

mistermojo

unread,
Nov 20, 2012, 5:13:54 PM11/20/12
to ged...@googlegroups.com
Thank you kindly!
Reply all
Reply to author
Forward
0 new messages