开发者

Rails 2.3.5 Creating RESTful routes for a model named "Software"

Topic says it all guys, my program needs to be able to keep track of the "software" that belongs to a user, as such I have a MVC for "Software". However, I can't use RE开发者_如何转开发STful routes at the moment since my plural and singular names are the same, it's "software" for both. Can anybody help me either, create new named routes or suggest a new name for my MVC that still implies "software" but has different singular/plural?


Why don't you call it SoftwareItem so you can have SoftwareItems...?


If you really need to have your model named Software, you should do what is needed for uncountable-noun-named models:

map.resources :software, :singular => "software_item"

That way you'll have helpers like

new_software_item_url
software_item_url(software)

etc. Otherwise it's hard for Rails to tell whether you're using "software" as singular or plural :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜