Note that there are some explanatory texts on larger screens.

plurals
  1. POstack level too deep error in jquery datatable with include modules outside class
    primarykey
    data
    text
    <p>when i first visit the page with jquery datatable it works fine but after visiting the page any page i go or reload i get stack level too deep. I followed <a href="http://railscasts.com/episodes/340-datatables" rel="nofollow">http://railscasts.com/episodes/340-datatables</a> </p> <p>This is my code </p> <pre><code>include Rails.application.routes.url_helpers class BookingsDatatable delegate :params, :link_to, to: :@view def initialize(view) @view = view end def as_json(options = {}) { sEcho: params[:sEcho].to_i, iTotalRecords: Booking.count, iTotalDisplayRecords: bookings.total_entries, aaData: data } end private def data bookings.map do |booking| [ booking.booked_by, booking.client_ref, booking.booking_type, booking.start_date, booking.end_date, link_to("Invoices", booking_invoices_path(booking)), link_to( "Edit", edit_booking_path(booking)) ] end end def bookings @bookings ||= fetch_bookings end def fetch_bookings bookings = Booking.order("#{sort_column} #{sort_direction}") bookings = bookings.page(page).per_page(per_page) if params[:sSearch].present? bookings = bookings.where("client_ref like :search or booked_by like :search", search: "%#{params[:sSearch]}%") end bookings end def page params[:iDisplayStart].to_i/per_page + 1 end def per_page params[:iDisplayLength].to_i &gt; 0 ? params[:iDisplayLength].to_i : 10 end def sort_column columns = %w[booked_by client_ref start_date end_date booking_type] columns[params[:iSortCol_0].to_i] end def sort_direction params[:sSortDir_0] == "desc" ? "desc" : "asc" end end </code></pre> <p>It works fine when i include the module Rails.application.routes.url_helpers inside the class but if it is at outside the class i get this error stack level too deep (works fine with first page visit but error after that). i have no idea why this happens.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload