Leave a specific row on top of sorted results

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Leave a specific row on top of sorted results

fugee ohu
How do I leave a specific row on top of sorted results I'm displaying news stories and I want the top story to stay on top for as long as it's the top story

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/145c5f68-c155-4b8f-a4f6-8fbc7161f469%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Leave a specific row on top of sorted results

Colin Law
On 4 June 2018 at 12:10, fugee ohu <[hidden email]> wrote:
How do I leave a specific row on top of sorted results I'm displaying news stories and I want the top story to stay on top for as long as it's the top story

I can't understand how you have to keep asking such basic questions.  Isn't it obvious?  Mark it in some way then do a sort on the two fields (top or not, and date or whatever else you are sorting by) so that it sorts by date within the topiness value.  Alternatively just remove it from the set to be sorted before you sort them.

Colin
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/145c5f68-c155-4b8f-a4f6-8fbc7161f469%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtk2WC0_doV4B_gLcO9n1tbtKo87Hai8ZkCF3ctUvuzcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Leave a specific row on top of sorted results

fugee ohu


On Monday, June 4, 2018 at 8:31:35 AM UTC-4, Colin Law wrote:
On 4 June 2018 at 12:10, fugee ohu <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="C4j2x6oJAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">fuge...@...> wrote:
How do I leave a specific row on top of sorted results I'm displaying news stories and I want the top story to stay on top for as long as it's the top story

I can't understand how you have to keep asking such basic questions.  Isn't it obvious?  Mark it in some way then do a sort on the two fields (top or not, and date or whatever else you are sorting by) so that it sorts by date within the topiness value.  Alternatively just remove it from the set to be sorted before you sort them.

Colin
 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="C4j2x6oJAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="C4j2x6oJAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/145c5f68-c155-4b8f-a4f6-8fbc7161f469%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/145c5f68-c155-4b8f-a4f6-8fbc7161f469%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/145c5f68-c155-4b8f-a4f6-8fbc7161f469%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/145c5f68-c155-4b8f-a4f6-8fbc7161f469%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


Sorry you're right Of course I know how to do it I wanted to know if there was a commonly used helper method that I didn't know about I decided it wasn't a good idea anyway and made a special section for top story because otherwise people will assume it's still the most recent story and disregard the following stories every time they revisit the page

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/76ddac9a-baf1-4281-a860-998820a1122e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.