|
I'm starting out with a project in Rails, and have a couple questions: - Why doesn't references in create_table in my migration create a foreign key? Why do I have to run a "execute 'ALTER TABLE ...'? I thought the whole point of Rails was to not repeat myself. - Why doesn't acts_as_list automatically add 'ORDER BY position' clause when calling Foo.find(:all)? I've said it's a list with a position column, why do I have to specify this again in my controller? - How do I create functions like 'edit_thingies_path' used in link_to in my view for other controller methods? I spent a 3 hour train ride trying to figure this out but all I got were stack traces and I reverted to specifying the action and arguments manually.
|
# ¿ Aug 3, 2008 22:54 |
|
|
# ¿ Apr 26, 2024 23:05 |
|
wunderbread384 posted:The Rails folks don't believe in foreign keys so you probably won't ever see support for them in core. It's stupid, but one of the many downsides to Rails being "opinionated software" is when their opinion is wrong. Is it just me or is there a huge "don't trust the database" vibe coming from the Rails camp?
|
# ¿ Aug 5, 2008 09:39 |
|
wunderbread384 posted:There's a bunch of plugins you can get that will do it, though, try Foreign Key Migrations. 1500 rows of code that can't automatically figure out that my primary key columns aren't named "id", even though the primary keys are specified in the schema, migrations and models. Quality code right there. Yes, I should probably just let my database be a stupid object store, but a lot of habits (foreign keys, naming primary keys to make joins easier) are hard to shake.
|
# ¿ Aug 6, 2008 08:01 |