Query to add edited entries to the top of a paginated list

Hello, I have a will paginated list of properties and I'm trying to find a way to display the most recently updated entries at the top of the list based on their most current modify date. The approach I'm taking is to use mysql UNION in paginate_by_sql and here's my code:
#property_ids is an array of property id's that have been edited
edited_list_where = " WHERE properties.property_id IN (#{property_ids.join(', ')[0..-1]} )"
if(params[:page].to_i > 1)
  property_limit = " LIMIT #{property_ids.length} OFFSET #{(params[:page].to_i*10)}" if (property_ids.length > 0)
end
Property.paginate_by_sql("(SELECT properties.*, layouts.* FROM properties
                             LEFT OUTER JOIN layouts ON layouts.property_id = properties.property_id
                               #{edited_list_where}
                                   ORDER BY properties.modify_date ASC #{property_limit})
                          UNION
                             (SELECT properties.*, layouts.title FROM properties
                        LEFT OUTER JOIN layouts ON layouts.property_id = properties.property_id
                           WHERE properties.property_type='apartment' ORDER BY properties.property_status ASC)", :page => params[:page], :per_page => 10)This approach works perfectly when you're on the first page and the edited properties show up first ordered by the last edited, but when you're on any other page, the edited list doesn't appear on top.
It seems like I'm asking quite a lot and I'm not sure this is even fully possible w/out adding some complicated hacks.
Any ideas?
Thanks!
Clem C

The downside is that a ChoiceGroup can't be IMPLICIT.
Best course of action would be to implement a menu on a canvas and then you have complete control over appearances...
shmoove

Similar Messages

  • How to Add multiple entry to the group policy security filtering

    How to Add multiple entry to the group policy security filtering
    Is there any way we can add multiple entry to the Domain group policy Security filtering tab.Currently its not allowing to add more then one entry at a time.
    Getting Error like "only one name can be entered,and the name cannot contain a semicolon.Enter a valid name"

    Hi
    Are you trying to add more users or groups through Group Policy Management Security Filtering tab?
    Try right clicking on the policy and then edit
    Then in Editor Right click on the name of the policy and Properties
    Security tab and add user or group from this tab. Just make sure if you are adding user or groups "Select this object type" has
    the correct option also "From this Location" is set to your entire directory not the local server.
    Update us with the above.
    Thanks

  • Adobe download needs "edit options" on the top right corner to allow download can't find on screen

    trying to download Adobe reader.....directions say for firefox users, "edit options" must add Adobe to list of allowables. I can't find "edit options" in the top right corner ......possibly Windows 7 change???

    Those are instructions for older versions of Firefox. Use the "manual installer".
    http://kb2.adobe.com/cps/191/tn_19166.html#main_ManualInstaller

  • A function module to add an entry to the change log of the ODS needed

    Hi all,
    I want to add an entry to the change log table of the ODS .
    Is there a Function module available for this or a work around for this.
    Regards
    Akshay

    Hi Kiran,
    You can directly add days to the date.
    Eg:
    DATA date LIKE sy-datum.
    DATA days TYPE i.
    date = sy-datum.
    days = 100.
    date = date + days.
    WRITE date.
    Regards
    Wenceslaus

  • How do I add an entry to the auto correct spell check dictionary?

    How do I add an entry to the auto-correct dictionary for spell check?

    The suggestion from Encrypted11 is for adding a keyboard shortcut, if that is what you want to do. If you want to add a custom word to the keyboard dictionary ....
    The iPad Dictionary
    The iPad has a dictionary built in. As you type, it compares what you've typed against the words in that dictionary. If it finds a partial match, it displays a suggestion just beneath what you have typed.
    If you accept the suggestion by tapping the Space or full stop, great.
    If you allow the 'mistake' to stand, the second time you type the same word and reject the correction, iPad adds the new word to its custom, dynamic dictionary. From now on, it will accept the new word and will even suggest it the next time you type something like it.
    That is copied from here.
    http://www.my-iguru.com/ipad/ipad-hints-tips/ipad-keyboard-tips-tricks.php

  • How can I add new songs to the top (not the bottom) of my playlist in iTunes?

    How can I add new songs to the top of my playlist in iTunes?
    I thought thats what it did before but now it automatically adds new songs to the bottom of the list.
    Not a huge issue but an annoyance.

    Go to your Music library
    Then, Click Playlist
    Then, Click the sort arrow until it points down.

  • How do you add an entry in the monitor log from the update rules?

    How do you add an entry in the monitor log from the update rules?

    Check this link for relevant SAP recommended implementation.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0c22e690-0201-0010-9581-832abdb5d50d
    Sample Code (Routine) available on the last page of the document.
    award points if useful

  • When do I need to add an entry in the "back to my mac" area?

    Documentation and help is just too terse in this area.
    When do I actually have to make an entry into the "Back to My Mac" list, and what does it actually do?
    What is the purpose of multiple entries?
    I have a remote family member that can already get to their disk shares, even though there is no entry for that MobileMe/iCloud account in my AirPort Extreme.
    On the flip side, they cannot get to the disk shares I actually want them to see, which are on a different computer.
    Need more concrete info!
    Thanks!
    -Rick

    When do I actually have to make an entry into the "Back to My Mac" list, and what does it actually do?
    You would make entries in the Back to My Mac field if you want to be able to access your AirPort base station or an attached AirPort Disk from a remote location.
    Back to My Mac (BTMM) requires both an Apple ID and an iCloud account from Apple.
    To get an idea on how to use BTMM to gain access to an AirPort Disk remotely please check out the following AirPort User Tip. Note the section specifically on BTMM.
    What is the purpose of multiple entries?
    It allows you to configure the AirPort to be accessed from multiple iCloud accounts.

  • Seeing my own phone number at the top of my contacts list

    Does anyone know how to turn off the feature of your own phone number appearing at the top of your Contacts list? It appears at the top of All Contacts and my groups--but I know my number and don't want to see it! I've been all through settings. I'm in the US; I guess the UK has a slightly different format. Just wondering if I can turn off that option!

    No you cannot turn it off.
    Honestly it doesn't take but about 1/2 an inch of the screen and I honestly cannot see why this becomes problematic when viewing contacts.

  • HT202879 how do i add a line to the top and bottom of a text box only

    i have a text box in my Pages document but i need to be able to add a line tot he top and bottom only to my text box. can i pleae get some help.

    Hello alegna23,
    To add a line just to the top and bottom of a text box, you will need to add the two lines as shapes.  Follow the steps below to add a line to your document:
    Add a shape
    Click Shape in the toolbar.Click the arrows to see more shape styles.
    Select a shape to add it to the page.
    In step 2, select a line and use the squares on the end of the line to help resize the line.  You can find the full article here:
    Pages Help for Mac - Add and edit shapes
    http://help.apple.com/pages/mac/5.0/#/tan9ad18c384
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • How to add a child at the top of the z-order(above a mobile textinput field)?

    We posted a problem yesterday with PopupManager where in a mobile app, we experience some strange problems, and have had to make our own modal Alert panel to solve the problem.
    The problem now is that if the alert panel is displayed over a TextInput field(mobile android app), the text in the textinput  shows through the Alert panel, and is obviusly higher up in the z-order than our alert panel.
    The alert panel  was added as a child of the main app window, and is as far as we can tell the top level component.
    Since the PopupManager does not have this problem, there must be a way to add our panel so it is displayed over the mobile textinput field.
    Is there any way to accomplish this?
    Thanks,
    Bob
    EDT

    Hi Bob,
    I'd recommend posting for suggestion in the mobile development forum, but if you do suspect this is a bug please go ahead and open a new report at bugbase.adobe.com and include sample code so we can see what's going on.
    Thanks,
    Chris

  • Add new items to the top of a list in iWeb

    One of my sites is for a cat charity :
    www.catsprotectionshop.com
    When a new cat is added it is easiest to add it to the bottom of the page. The alternative would be to move all the others down to put it at the top.
    Is there an easy way to move the existing items down, please?

    Here's the page in iweb :
    And this is thepage on the web :
    http://wyodor.byethost8.com/cats/Adoption/Adoption.html

  • How to add new row at the top of the advance table.

    Hi,
    I have one advanced table.
    I want to add new rows in advanced table. I can able to add rows using the AddMoreRows button in the footer of the advanced table.
    This adds the row at the end. But I want to add the row at the top.
    How to achive this? Please suggest.
    Thanks & Regards,
    Raja

    Hi,
    Yes you can do it...
    Just set the add Rows automatically property to False of Add Row Button
    and then in processForm Request capture the addRows event
    and invoke a method in AM and then create a new Row in VO.
    Use this code...it will insert row at the top...
    if("addRows".equals(event))
    am.invokeMethod("addrows");
    public void addrows()
    AddressesVOImpl vo1 = getAddressesVO1();
    AddressesVORowImpl row1 = (AddressesVORowImpl)vo1.createRow();
    vo1.insertRowAtRangeIndex(0,row1);
    vo1.setCurrentRow(row1);
    Thanks,
    Gaurav

  • How to add an entry in the currency conversion table

    Hi all,
    I am loading data to ODS from 2LIS_11_VAITM. i am getting an error as below in a record.How do we enter a missing entry in the currency conversion table? Please help.
    Kind Regards,
    Shanbagavalli.S
    Enter rate EUR / EUR rate type 00000000 for 2200016564 in the system settings     
    Message no. SG105
    Diagnosis
    For the conversion of an amount into another currency, an entry is missing in the currency conversion table.
    Procedure
    Add the missing entry in the currency conversion table.
    Execute function
    You can then continue to process the commercial transaction.

    Hi,
    Goto RSA1 -> source system -> R/3 source system -> transfer exchange rates.
    Bye
    Dinesh

  • How can i get the downloads window back? i hate the add-on thing at the top right. can i change this?

    I liked how FireFox used to have a downloads window when I would download. But, now its like som sort of add-on, it's at the top right and I dont like it very well. Can I get the window back somehow? Thanks, Lego893.

    There is a way, but it may not be supported for ever... If you want the old download manager back, go to about:config, click the I'll be careful, I promise! button. Then search for "download", and set the browser.download.useToolkitUI preference to true (double-click it).

Maybe you are looking for

  • Front end and back end questions

    Hi, If I want to develop a web base SOA application by using Jcaps, I have several question want to ask. 1.) In the front end, if i create the page by using eVision to create the page flow and the page layout, how can I match the fields of the page (

  • Digital signatures getting more difficult

    I'm sure there are good reasons for the changes, but from my viewpoint digital signatures in Acrobat are becoming less convenient with each new version I try. I make extensive use of invisible signatures, with a number of people required to invisibly

  • ERROR IN BPM Synchronous Sender-Urgent

    Hi ALL, I has the following Integration Process: Receiver-----Synchronous Sender-- Sender(async) When iam trying to Split the Message in Synchronous Sender where the receiver for Synchronous send message is a HTTP adapter iam getting the following Er

  • Uniemens - Italy

    Hi gurus, for our company we have implemented the new legale procedure about Uniemens. Our release is 5.0. We have problems about a report RPCUEMI0. We think that the problems are connected to the release. For example, the data are registried on RPLC

  • Sync to .mac does not include iCal

    My address book synced to .mac but not iCal.