You are here: Forums Ask a Rails expert Remove record with composite P...
Posted in Forums : Ask a Rails expert
Authority 0
Posting Rating 14
Sign in to rate this post
|
Hello I have a table with the following primary key: (user_id, class_id). self.primary_key = “user_id, class_id” Now, in the controller I created a method to remove a record of that table. When the PK is normal (ie, not a composite one), it is only necessary to write a line like the following: Model.delete(id) Since my model have two fields in the PK, how can I do that? Thanks |
Authority 62
Posting Rating 100
Sign in to rate this post
|
I guess you could take a look at Dr Nic’s composite primary keys gem: http://compositekeys.rubyforge.org/ |
Authority 0
Posting Rating 14
Sign in to rate this post
|
Nice. |
Ask a Rails expert : json gem error
Ask a Rails expert : Problem with break
Ask a Rails expert : activesupport string first method error
Ask a Rails expert : url_for broken ?
Ask a Rails expert : map.routes.rb pls help
Ask a Rails expert : how to h tag in controller
Ask a Rails expert : Problem with Restful routing and partial form
Ask a Rails expert : will_paginate, search and ajax
Ask a Rails expert : Mass Deletes in Admin Section