Re: [Rails-core] REST default routes for create.

2012-08-08 Thread Steve Klabnik
>From a REST perspective, the URL is 100% irrelevant. I havent tested it with analytics or anything, I'm pretty sure that the number of people who go "oh, my form failed. I'd better see what the URL is. Oh, /things!' How odd? I expect that to be a list?? What's going on???' is zero. /things works

[Rails-core] REST default routes for create.

2012-08-08 Thread Harshal
I am fairly new to Rails and I am trying to understand the default routes generated by resources in routes.rb Is there a justification for having the default route generated by resources for create as "/things" POST /things(.:format) {:action=>"create", :controller=>"thin

Re: [Rails-core] Activerecord: how to write a new feature?

2012-08-08 Thread Pedro Nascimento
Take a look at ARel and Squeel gem. Squeel gem supports something like this already. On Wed, Aug 8, 2012 at 12:05 PM, Rafael Almeida wrote: > Hello. > > Let's say I have the following schema > > People <---> people_services <---> services > > That is, people has a many-to-many relationship wi

[Rails-core] Activerecord: how to write a new feature?

2012-08-08 Thread Rafael Almeida
Hello. Let's say I have the following schema People <---> people_services <---> services That is, people has a many-to-many relationship with services. Say I want to find all people who has services of types 1 and 2. How can we do it on activerecord today? My best solution so far is this

Re: [Rails-core] UUID primary keys for ActiveRecord

2012-08-08 Thread Ken Collins
>>> But when using UUIDs, there is no reason to ask the database for a >>> newly-inserted record's ID. >> >> There is if ActiveRecord uses it for a primary key. > > But ActiveRecord will have generated it, and given it to the DB to > insert - the DB won't have generated it; so there's no need t

Re: [Rails-core] Re: Feature request: allow formats with dot in resourceful routing, like '/users.xml.zip'

2012-08-08 Thread Farski
Just out of curiosity, do you have any examples of multiple extensions where those other than the root extension aren't a compression or archive format? I ask in the context of this being considered a bad practice. To me, naming something anImage.jpg.zip.tar.gz means I started with a JPEG, and

Re: [Rails-core] UUID primary keys for ActiveRecord

2012-08-08 Thread Michael Pavling
On 8 August 2012 14:33, Ken Collins wrote: > >> But when using UUIDs, there is no reason to ask the database for a >> newly-inserted record's ID. > > There is if ActiveRecord uses it for a primary key. But ActiveRecord will have generated it, and given it to the DB to insert - the DB won't have

Re: [Rails-core] UUID primary keys for ActiveRecord

2012-08-08 Thread Ken Collins
> But when using UUIDs, there is no reason to ask the database for a > newly-inserted record's ID. There is if ActiveRecord uses it for a primary key. > Instead, the application can generate these UUIDs itself. This is, for > example, what Hibernate and Mongoid do. This is what my wiki articl

Re: [Rails-core] UUID primary keys for ActiveRecord

2012-08-08 Thread Jay Feldblum
The only reason to ask the database for a newly-inserted record's ID, for sequential numeric IDs, is because the database maintains the sequence and only the database can get the next number in the sequence. But when using UUIDs, there is no reason to ask the database for a newly-inserted recor