Need some assistance with routing -- 'resource' using natural key

I want to create a resource, let’s say ‘cars’, which are accessed by
license_number rather than id.
The column in question is guaranteed to be unique and unchanging (and
no, it’s not actually a car table).

Best way to go about this?

Thank you,
Isak

class Cars < ActiveRecord::Base

def to_param
return self.license_number
end

end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs