Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorpogeybait4883
    It seems like sortable_link works well if you are pulling data from only one database but what happens if you have to do a look-up on one of the fields? Consider the following model for my activity log. It has the following fields in the database:
    user_id int(11),
    ip_address varchar(255),
    controller varchar(255),
    action varchar(255),
    params text

    The user_id is obvisously an integer representing a user_id so in my view I would need to do a look-up to get the user login or user name based on that id. I'm going to paste my listing.tpl view and I was wondering if anyone could tell me how to sort on the user field. See below for the code:

    <div id="comment-listing" class="action listing">
    <h1>_{Manage Contest}</h1>
    <h2>_{Contest Activity Log}</h2>
    <th><%= sortable_link 'ip_address', {}, :link_text => _('IP Addr') %></th>
    <th><%= sortable_link 'controller', {}, :link_text => _('Controller') %></th>
    <th><%= sortable_link 'action', {}, :link_text => _('Action') %></th>
    <th><%= sortable_link 'params', {}, :link_text => _('Params') %></th>
    {loop activity_logs}
    <? $log_user =& $CurrentContest->user->find( 'first', array('conditions'=>array( 'id = ?', $activity_log->user_id ) ) ); ?>
    <div id="AddressPagination">
    <div id="paginationHeader"><?php echo translate('Showing page %page of %number_of_pages',

    <p>_{No activity has been logged at this time.}</p>


    -- pogeybait4883