Accessing column information with ActiveRecord
A quick tip - ActiveRecord provides a number of methods that allow you to access information about the underlying table columns for a model.
The following entries are tagged with “database”:
A quick tip - ActiveRecord provides a number of methods that allow you to access information about the underlying table columns for a model.
Sometimes you might want to find all records from a specific offset but ActiveRecord won’t let you: if you use the :offset option without specifying a :limit you won’t get an error, Rails will just silently discard the offset.
Ok, so I’m starting a new Rails application, I’ve spent some time refining my database, I’ve considered storage requirements and performance when choosing the data types for my fields and now I’m ready to create some migrations to implement my design.
And then I’m reminded that, lovely though Rails migrations are, there are two things that really bug me about them: they create signed primary keys and they don’t allow me to easily create unsigned integer columns.
It’s been discussed before, dismissed as an ‘uncommon requirement’ (probably because MySQL is, as far as I know, the only database that uses unsigned integers) and, as far as I can tell, not a lot more has happened. So, while sat out in the garden, enjoying a sunny Saturday afternoon, I grabbed edge Rails from GitHub and decided I’d see if I could do something about it (how’s that for geekyness?!)