similar to: OOP basics

Displaying 20 results from an estimated 1000 matches similar to: "OOP basics"

2006 Mar 09
1
very basic newbie question!
Bringing up (trying!) my first rails app... no OO experience the scaffold generator automatically creates new activerecord objects for the create/edit form using: def new @schoolclass = Schoolclass.new end I wanted to initialize the object, so I added to the object creation statement as follows: @schoolclass = Schoolclass.new(:day=>1, :start_time=>"2006:01:01 00:00:00,
2006 Feb 18
6
Naming join models
I''ve been playing around with EdgeRails and checking out some of the new features. The one that will probably have the biggest affect on my designs is join models (or :through associations). For those not familiar with this feature, it lets you replace your habtm association with a pair of has_many associations indirected through an intermediate model class. Looks like good
2006 Mar 21
5
Getting a time select input
I''m having trouble workign out which ActionView DateHelpers to display a time input for an ActiveRecord field of type :time. I just want an hours input and a minuites input. I can get these with time_select helper using :field_name and :prefix but it gives both hours and miniutes the same name. <%= select_time(Time.now, :prefix => "search", :field_name =>
2006 Jul 25
4
Sorting by two fields
I have a list of TimeSheet objects from an ealier AR query, which I can sort by the full name of the user like so: @time_sheet_entries.sort! { |a,b| a.user.full_name <=> b.user.full_name } I can sort by the started time like so: @time_sheet_entries.sort! { |a,b| a.start_time <=> b.start_time } My question is how do I do a sort so that the list is sorted primarily by user.full_name
2006 Aug 30
7
AAF Sorting by date - what am I doing wrong?
I''m trying to sort my search results by Date, in descending order. I''ve done quite a bit of reading through the forums here, and I''ve tried two different suggestions. This just returns results in the same order as a search without a sort: sort_fields = [] sort_fields << Ferret::Search::SortField.new("ferret_created_at",:reverse => :true)
2006 May 27
7
How should I select rows from a join-model based on more than one association?
A concrete example: We''re building a system to organize the information about workshops being held in various conventions. A convention has more than one workshop, and each workshop can be held in more than one convention. Also each workshop has a host, who is specific to a workshop being held in a specific convention. For example, Matz may host an "Introduction to Ruby"
2001 Nov 29
1
patch from faith@alephnull to add rate indicator to --progress
Any votes for/against? ----- Forwarded message from Rik Faith <faith@alephnull.com> ----- Date: Wed, 28 Nov 2001 12:55:29 -0500 From: Rik Faith <faith@alephnull.com> To: mbp@samba.org Subject: rsync patch X-Mailer: VM 6.96; XEmacs 21.1; Linux 2.4.16 (light) Here is a patch that adds rate information (e.g., kB/s) to the --progress display. I just noticed that 2.4.7pre4 is coming
2000 Aug 01
2
ogg123 timekeeping
Does this look okay? : Time: 1:15.50 of 4:13.73, Bitrate: 133.3 How about? : <snip from=ogg123.c> info.u_time = ov_time_total (&vf, -1); /* Seconds with double precision */ gettimeofday (&start_time, NULL); t_min = (long) info.u_time / (long) 60; t_sec = info.u_time - 60 * t_min; while (! eos) { gettimeofday (&cur_time, NULL); c_min = (long)
2006 Sep 22
2
I''m misunderstanding how stubs works
We''re still just starting out with Mocha/Stubba, so please forgive any newbie errors. I''m using "stubs" to test some realtime functions, to control exactly which time is returned from Time.now. I would expect the following test to pass: def test_two_stubs t = Time.now - 60 Time.stubs(:now).returns(t) start_time = Time.now t += 20
2006 Sep 25
3
Engine Yard blog
Just received the news from Tom Mornini. Congrats Ezra for the new Engine Yard site and the blog you will be collaborating. Hope to read you there soon. http://www.engineyard.com/ Jonathan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060925/3f251fa4/attachment.html
2006 Apr 15
2
Multi-parameter assignment
Hi, I''m trying to submit data from text boxes on a form to one variable in my controller, in the same way that datetime_select has date(1i), date(2i), etc for day, month, year, etc... I''ve named my variables event[start_date(1i)] event[start_date(2i)] and event[start_date(3i)] but this doesn''t seem to work and event[:start_date] is blank ... any pointers would be
2004 Feb 27
2
patch: better progress meter
Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: This is a digitally signed message part Url : http://lists.samba.org/archive/rsync/attachments/20040227/923b87ee/PGP.bin
2014 Feb 21
5
[LLVMdev] interesting LLVM code optimization issue regarding timer registers
This problem was reported to me by a friend who has an LLVM port that is not put back to open source. Essentially, there is an intrinsic call _lr which is a load register. so then user code has something like: start_time = _lr(TIMER_REGISTER) ..... some_code_to_time .... end_time = _lr(TIMER_REGISTER) So what happens is that LLVM moves the code as follows: start_time = _lr(TIMER_REGISTER)
2006 Apr 05
2
validates_uniqueness_of with habtm
it''s a blog... class Entry < ActiveRecord::Base has_and_belongs_to_many :categories end similarly: class Category < ActiveRecord::Base has_and_belongs_to_many :entries end I wish to make sure that the owner doesn''t add the same category to a given entry more than once... I''m thinking that validates_uniqueness_of should be usable here. But can''t
2013 Aug 22
1
How do I deal with ActiveRecord::RecordInvalid: Validation failed:
Hello all, I am currently writing model tests in rails 4. I am attempting to add an error to a reservation object if the total number of reservations for a given date and time has reached a pre-determined limit. When my test runs, it is hitting the appropriate code but it is raising the following error as opposed to just giving me an error in the object that I can use.
2006 Aug 01
6
Newbie: How to use text_field with Java Script
<input type="text" name="date1" id="dateField1" onchange="magicDate(''dateField1'');" onfocus="if (this.className != ''error'') this.select()" /> How could I generate above text filed using ruby? I am not sure how to give the options such as onchange, onfocus, id and so on? could some one please help. --
2010 Nov 02
2
multi-level cox ph with time-dependent covariates
Dear all, I would like to know if it is possible to fit in R a Cox ph model with time-dependent covariates and to account for hierarchical effects at the same time. Additionally, I'd like also to know if it would be possible to perform any feature selection on this model fit. I have a data set that is composed by multiple marker measurements (and hundreds of covariates) at different time
2012 Oct 12
1
Adding Time when Blanks
Greetings, My data set has dates and times that I am working with. Some of the times in Time_of_end are blank. This is supposed to dictate that the particular experiment lasted 48 hours. I would like to add 48 hours to the start Start_of_Experiment for another column as End_of_Experiment including both the ones with 48 added and those with early times. I was thinking something with a
2008 Mar 06
4
Active Record Question
Hi- Say I am returning some collection of DateTime items and I only want to compare the month. Is there a way to do this directly in the find? Something like this... @coll = Collection.find(:all, :conditions => ["date.month = ?",Time.now.lat_month]) Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google
2009 Mar 07
1
Cdr problem
hi, I'm working with asterisk on a project and I found a problem with cdr_odbc. As we know, after answering each call a cdr event is raised which is saved in cdr_csv and cdr_odbc. but here my point is on cdr_odbc. some information, including start_time and end_time is given by cdr event but the problem is that these two information(start_time and end_time) is not getting save in cdr_odbc. I