Wednesday 15 September 2010

ruby on rails - I do not understand how to use ranked-model -


I am using the gem rank model:

I allow it to allow my users I want to use order order in a back office.

Whatever I understand from Gmail is different from the value stored in DB, which is the real rank if you start counting your elements.

Now if I have an array of images, then I display them and I want to increase or decrease my position of rank. I have to do a line_driver_pivision +1 or -1 but I can not know their line_order of their line_provisionion (this returns zero)

My question is if I can not know row_order_position then what can be used to be able to change by row_order_position? every_with_index to do one thing. This way you can store a location (for example in a hidden area), and when the rearrangement of the articles is displayed, the new position + or - 1 passes.

  # Something like this & lt; % Article.each_with_index | Article, Index | & Gt%; & Lt;% = Render: Partial = & gt; 'Article',: local = & gt; {: Article = & gt; Article ,: position = & gt; Index}%> & gt; & Lt;% end% & gt;    

No comments:

Post a Comment