Displaying 6 results from an estimated 6 matches for "end_at".
2006 Jul 16
4
Calculations across multiple tables
I have a time tracking app where (pseudo-code)
Client has_many Task has_many TimeRecord
TimeRecord
start_at, :datetime
end_at, :datetime
What I''m trying to do (and I have done using find_by_sql in the past) is get
a sum of the timespan given by ended_at - begun_at for each client.
Is it naive to imagine that AR''s calculations will span relations to provide
a grouped result?
The SQL I''m feedin...
2006 Oct 03
1
line too long in editor... (textmate)
my where :condition string line is too long in my editor, (Textmate...)
if I do a LR, I got a \n in my string, how can i get it displayed in
multilines without this garbage in the string :
here is the kind of string I am manipulating
cond_a.append ["(bookings.start_at == ? OR bookings.end_at == ? ) OR
(bookings.start_at <= ? AND bookings.end_at >= ? )",
@selected_booking_date, @selected_booking_date, @selected_booking_date,
@selected_booking_date]
thansk fyh
kad
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You receiv...
2007 Nov 29
4
collection.build or collection.create gives "ArgumentError: wrong number of arguments (1 for 0)"
I have a Project that has_many Tasks. Tasks belongs to a Project. When
I try the following:
project = Project.new
project.tasks.build
I get:
>> s = Project.new
=> #<Project:0x25f9e28 @attributes={"name"=>"", "end_at"=>nil,
"updated_at"=>nil, "published_at"=>nil, "user_id"=>nil,
"created_at"=>nil}, @new_record=true>
>> s.tasks.build
ArgumentError: wrong number of arguments (1 for 0)
from /Applications/Locomotive2/Bundles/
standardRailsMar2007...
2006 Nov 23
2
Conditional queries
...uot;)} )
search_end_date:( >= #{Time.now.strftime("%Y%m%d")} )",
[],
{:offset => @offset, :limit => @limit}
)
Page.rb
def search_start_date
self.start_at.strftime("%Y%m%d") if self.start_at
end
def search_end_date
self.end_at.strftime("%Y%m%d") if self.end_at
end
The problem being that I can''t figure out how to do the equivalent of:
search_end_date:( IS NULL OR >= #{Time.now.strftime("%Y%m%d")}
)",
Thanks for any help/advice,
Cam
--
Posted via http://www.ruby-forum...
2008 Feb 19
0
Issue with Observers and has_one association...
...ly. So the following does not work:
class Task
has_one :current_instance,
:class_name => ''TaskInstance'',
:foreign_key => ''task_id'',
:order => ''start_at DESC'',
:conditions => ''end_at IS NULL''
but when replaced with the follwoing, it does work.
def current_instance
TaskInstance.find(:first,
:conditions=>"task_id=#{self.id} AND end_at IS
NULL",
:order=>''start_at DESC''...
2010 Nov 05
3
non event_calendar
What am I missing here, trying to get the event_calendar plugin working
with my existing app. Have installed the plugin, which I guess is a good
start, then this...
class Booking < ActiveRecord::Base
has_event_calendar :start_at_field => ''arrival_date'', :end_at_field =>
''departure_date''
Route...
map.availability_calendar ''/availability_calendar/:year/:month'',
:controller => ''properties'',
:action => ''availability_calend...