Ruby on Rails
Sunday, November 27, 2011
I have a telephone model in my rails application which is being updated from an android app.
The phone model consists of id, name, version, imei, etc. id is the primary key as by the rails standard.
imei is unique but not the primary key. when I update the model from the android app I dont have the id, only the imei number.
The way I see it I have 3 options.
1. create an action called update_version, do a find_by_imei and update my model. This is actually what I do now but this isnt very restful or pretty
2. During create assign imei to phone.id... I like this solution for it's simplicity, but I cant get it to work (for reasons I'll explain if requested)
3. make two requests to the server. 1. where I do a find_by_imei and return the id 2. update normally
I really hope you guys can give me some input on how to solve this issue in a pretty way.
Thanks in advance
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/4bRGwagbpQQJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment