[Rails] Re: Having trouble with named_scopes for my view

2016-03-11 Thread David Williams
Walter Davis wrote in post #1182112: > Part of one of the RailsConf sessions I went to, either last year or the > year before, could have been re-titled "default_scope considered > harmful". I don't think it's deprecated or anything, but it is > definitely something to use sparingly, and with

Re: [Rails] Re: Having trouble with named_scopes for my view

2016-03-10 Thread Colin Law
On 9 March 2016 at 22:25, David Williams wrote: > Colin Law wrote in post #1182073: >> On 9 March 2016 at 21:51, David Williams wrote: >>> "articles"."category_id" = ? ORDER BY "articles"."created_at" DESC >>> [["category_id", 1]] >>> >>> >>> I'm getting undefined method `each' for # >> >> That

[Rails] Re: Having trouble with named_scopes for my view

2016-03-09 Thread David Williams
Colin Law wrote in post #1182073: > On 9 March 2016 at 21:51, David Williams wrote: >> "articles"."category_id" = ? ORDER BY "articles"."created_at" DESC >> [["category_id", 1]] >> >> >> I'm getting undefined method `each' for # > > That is because you only have a single Article, not a collection