change the return of to_param by action? or, terribly broken edit action if perma-url is returned in

Posted by Stacia on Stack Overflow See other posts from Stack Overflow or by Stacia
Published on 2009-10-20T07:55:33Z Indexed on 2010/06/12 18:02 UTC
Read the original article Hit count: 202

Filed under:
|
|
|
|

I did some stuff to have to_param return a perma-url so I'd have seo friendly links. Upon creation and update it will generate and return the perma-url in a to_param method that I put in the model. However this causing me some grief in other areas. I have a form that looks like this:

   <% @apps.each do |app| %>

   <% fields_for "[id][]", app  do |fields| %>
      ....

this fails terribly since it tries to insert the perma-url in place of the id. If I could just restrict to_param by action, that could solve things. If I change app to app.id, that fails since I have stuff like this: fields.check_box :is_featured . I suppose I could get the app instance, but that feels hacky.

Again please excuse my lack of rails-foo ;)

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby