similar to: Pagination attributes

Displaying 20 results from an estimated 5000 matches similar to: "Pagination attributes"

2006 Mar 28
2
Fastest way of adding " " around multiline text in RADRAILS
lets say i have the following SQL in my database editor : When i paste it into rad rails i have to add quotes and the ''+'' symbol to the end of each line. It is very tedious. What is the best method? select timesheets.employee, sum(items.hours) as hours, sum(items.hours*timesheets.cost) as cost, sum(items.hours*timesheets.charge*decode(activities.chargetype,0,1,0)) as charge,
2008 Mar 06
1
pagination for an object array
def show_details @sd_ticket = ServiceDeskTicket.find(params[:id]) @servicedesk_cis = @sd_ticket.service_desk_cis end What I need is a pagination for @servicedesk_cis using the custom pagination..How can i give offset and limit to this? I have successfully done previously custom pagination in another def as below def search_sd_ticket @search_sd_ui_hash=params[:sd_ticket]
2006 Mar 14
3
cascading eager loading patch not working in oracle
Notice the "AS" keyword appears many times. Oracle does not support this keyword: ActiveRecord::StatementInvalid: OCIError: ORA-00905: missing keyword: SELECT tim esheets.id AS t0_r0, timesheets.start_date AS t0_r1, timesheets.status AS t0_r2, timesheets.cost AS t0_r3, timesheets.charge AS t0_r4, timesheets.employee AS t0 _r5, employees.id AS t1_r0, employees.name AS t1_r1,
2013 Mar 30
1
How to use group in nested associations
The below query fails: Timesheet.joins(:time_entries).select("timesheets.*, sum(time_entries.worktime) as total").group("timesheets.start_date") The models have the following relations: Timesheet < AR has_many :activities, dependent: :destroy, inverse_of: :timesheet has_many :time_entries, through: :activities accepts_nested_attributes_for :activities,
2008 Apr 26
0
moving pagination code to model
Hi I have the controller code as below # step 1: set the variables you''ll need page = (params[:page] ||= 1).to_i items_per_page = 20 offset = (page - 1) * items_per_page # step 2: instead of performing the full find, just find the record count @search_sd_ticket_count_result =
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows: class Timesheet < ActiveRecord::Base attr_accessible :status, :user_id, :start_date, :end_date, :activities_attributes has_many :activities, dependent: :destroy has_many :time_entries, through: :activities accepts_nested_attributes_for :activities, allow_destroy: true end class Activity < ActiveRecord::Base attr_accessible
2013 Mar 26
0
nested forms: use validate :some_method works in update mode only
I have a strange behavior when validating a record in a nested form. The association collection is empty when creating a new record and the validation does not catch the error. But when updating the same record the validation gets it right but continues to catch the error even after modifying the needed attribute value to make it pass. Here is the model: #timesheet.rb class Timesheet <
2006 Mar 01
1
Eager loading problem. Help greately appreciated
Each Timesheet has an employee. An employee has a division and a location. I want to find all the timesheets with a status of 2. I then iterate over the timesheet collection and print the timesheet name, employee name, employee divison name, and employee location name. Like so: for t in Timesheet.find(:all,:conditions=>"status=2",:include=>:employee) puts timesheet.date
2007 Jun 20
1
Count_by_content ??
Is there a count_by_content alternative to the find_by_content action? This is because I''m wanting to do the following in my pagination method: def list # step 1: set the variables you''ll need page = (params[:page] ||= 1).to_i items_per_page = 20 offset = (page - 1) * items_per_page # step 2: instead of performing a find, just get a count item_count =
2008 May 19
0
changed to will_paginate
Hi Till now we used the rails pagination.But now onwards shifting to will_paginate The code I use currently is as below .This is with the help of find_where pluggin..A fantastic pluggin which we still want to use...I would like to know how can i modify the following code to work with will_paginate step 1: set the variables you''ll need page = (params[:page] ||= 1).to_i
2006 Apr 06
6
pagination question
i''ve figured out how to use the next and previous links with the paginator class but now i''m trying to figure out how to display all the page numbers in between. looking through the rails api, i found paginator.each() but i''m not sure how to use it, or if that''s even what i am looking for. also, is there a way to limit the amount of pages like some sites
2005 Dec 23
1
pagination problem
hey, i have this problem in the database i have 32 records and the sql filtered 4 records #getting the callerid records depending on the given paramaters and paginate it @callerid_pages = Paginator.new self, CallerId.count, 10, @params[''page''] @caller_ids = CallerId.find(:all, :conditions =>["geotags.firm_id = ? ", @firm_id], :order => " geotags.address1
2006 Jul 16
3
pagination over custom-sorted collections?
I have a little web app where we need to paginate collections of items. I''m trying to sort the collection and then pass it, sorted, to a Paginator, and still be able to paginate through the collection, across several pages, with the new sort order. The only thing I''m doing differently from the regular scaffolding approach is this: @order_pages = Paginator.new(self,
2006 Apr 24
5
Custom pagination
I am trying to paginate objects from a has_many/:through relationship using Paginator. current_user.things returns the objects that I''d like to paginate. For testing, I tried to make it 1 item per page. I initialise the paginator as follows: @thing_pages = Paginator.new(self, current_user.things.count, 1, @params[''page'']) I don''t know how to obtain
2006 Jun 15
1
callback object problem
I''m trying to create a separate class to do validation so that about 10 models can use the same date validation. I have tried to use the example from the agile book but it''s not working. Here''s what I have: app/models/date_callbacks.rb class DateCallbacks def before_validation(model) if model.start_date > Date.today model.errors.add(:start_date, "must
2007 Jan 16
1
Can't pass parameters to Ziya controller using url_for
Hi All, I''m stuck yet again. I have an action on a controller that produces a Ziya graph, which I call using the gen_chart() helper. However, I can''t seem to pass more than one parameter through to the action. <%= gen_chart( "overview_graph", url_for( :controller => ''graph'', :action => ''graph'', :graph_id =>
2006 Jul 01
1
Paginator offset =0 ...
Hi list, I Try to do a custom paginator, but the offset never increase ?? def showFriends @friends_pages = Paginator.new self, allFriends.size, 3, @params[''page''] limit= @friends_pages.items_per_page offset= @friends_pages.current.offset
2006 Dec 27
0
HABTM Checkboxes - Adding/Updating Users to a Project
Hello all, I''m trying to create a HABTM checkbox action that adds/updates ''users'' to a ''project''. I have the following laid out. --------------------- TABLES --------------------- create_table "assignments", :id => false, :force => true do |t| t.column "project_id", :integer, :default => 0, :null => false
2006 Jun 15
1
Paginating a .find
how exactly would I apply paginate to a .find I have: @posts = Post.find(:all, :conditions => [ ''(title) OR (body) LIKE ?'', ''%'' + params[:query] + ''%''], :order => ''end_date'') How would I go about paginating the uoputed list? Something like 10 on a page. -- Posted via
2007 Jul 08
2
datetime_select, is creating an instance of the Time class
Hello It seems that datetime_select, is creating an instance of the Time class. Why would that be? I found this while building a site where people can create vigils (prayer vigils, peace vigils, etc). When I added a validation method that compared start_date to created_at, it generated the error: ArgumentError (comparison of Time with DateTime failed): I was able to put a breakpoint in the