Displaying 20 results from an estimated 800 matches similar to: "How to DRY up validates_presence_of"
2006 Apr 29
1
Warnings printed to console causes error if console closed on Linux
I had a statement that was generating a warning about parenthesise
argument for future version. The interesting thing was it would crash
the page with an input/output error on my production linux server, but
worked fine in webbrick/windows. I finally tracked it down to it crashed
when trying to print the warning to the console. If I kept the terminal
open that I started the server on it would
2006 Feb 16
5
Firefox and IE performance with Rails App
In my rails application, certain computers were having huge problems.
There were certain pages that were exceptionally slow, even to the point
of timing out. Other computers did not have a problem. I finally found
that Firefox was the difference. When using Firefox on those computers
it works fine. The slow pages were typically posting a form with a
couple hundred fields.
This behavior was
2006 Apr 20
1
has_many.count not accepting options hash
has_many.count does not seem to support an options hash like
ActiveRecord::Base.count does.
Example:
>> AcademicProgram.find(:first).course_requirements.count :conditions
=> "courses.name LIKE ''a%''", :include => :course
=> 40
>> ap.ap_requirements.count :conditions => "courses.name LIKE ''a%''",
:include =>
2006 Apr 20
3
has_many :through with has_many/has_many join models
It seems that using a join model that joins with two has_many''s will
fail to generate proper SQL
class StudentSemesterRecord < ActiveRecord::Base
belongs_to :semester
has_many :discipline_records, :through => :semester
end
class Semester < ActiveRecord::Base
has_many :student_semester_records
has_many :discipline_records
end
class DisciplineRecord <
2006 Aug 10
1
Customizing log output
I''d like to include the user name along with/instead of the session id
in my log files. Is there a place to customize the log format, or do I
just need to through the logger object and manually write it in a
before_filter on my ApplicationController?
Thanks.
--
Jack Christensen
jackc@hylesanderson.edu
2006 Mar 10
0
Data modeling - representing data across models
I''m having some difficulty deciding where to put logic that crosses models.
For example, given models people, departments, work schedules, and weeks.
Where would the following best fit:
who is scheduled to work in a given department in a given week?
how many hours is a given person scheduled in a given week?
how many hours is a given person scheduled in a department in given week?
how
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 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 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2006 Mar 13
0
Pagination attributes
I have created a pagination with my own conditions :
@timesheets_pages = Paginator.new self, count, 30, @params[''page'']
@timesheets = Timesheet.find :all,:include
=>{:employee=>[:location,:division]},
:conditions => ["employees.location=?
and employees.division=? and start_date>? and end_date < ?
2006 Feb 04
0
date_select
Can you see an obvious reason why this date_select code is failing?
The parameters from the form -
*Parameters*: {"commit"=>"Save All Changes", "campaign_id"=>"1",
"campaign"=>{"name"=>"fdsfas", "end_date(3i)"=>"26",
"start_date(1i)"=>"2006",
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
2010 Jun 08
2
type conversion with apply or not
Folks, i thought it should be straightforward but after a few hours poking around, I decided it's best to post my question on this list.
I have a data frame consisting of a (large) number of date columns, which are read in from a csv file as character string. I want to convert them to Date type. Following is an example, where the first column is of integer type, while the rest are type
2024 Oct 30
2
Extracting wind direction and wind speed from wind rose plot
Dear all;
I am searching for a way to extract wind direction and speed from a wind
rose plot. I have a graph and I want to make a dataframe of 5 years with
hourly intervals.
> start_date <- as.POSIXct("2019-01-01 00:00:00")
> end_date <- as.POSIXct("2023-12-31 23:00:00")
> time_sequence <- seq(from = start_date, to = end_date, by = "hour")
> df
2013 Jan 29
2
Count entries in postgresql grouped by date
Hi!
I have a table with visits with a visited_at: attribute which is a datetime
field. They seem to be stored as UTC. Now I want to count all visits each
day and return something like:
{
2013-01-01: 8,
2013-01-02: 4,
2013-01-07: 9,
...
}
So, I did it like this which kind of works...:
def self.total_grouped_by_day(start_date, end_date)
visits = where(visited_at:
2008 Oct 01
0
plotting several yearly/monthly time series on the same plotting several yearly/monthly time series on the same graph
I have searched the forums but I am having trouble trying accomplish two
specific plots. I am not sure if this is a very basic task but I am having a
lot of trouble Here is my data frame:
date prod_daily price
1 2003-08-15 12050 4.83
2 2003-08-18 12050 4.94
3 2004-08-10 12300 5.78
4 2004-08-11 12300 5.64
5 2004-08-12 12300
2009 Sep 19
0
Merging API data and ActiveRecord data for display in the view...
Hi there,
I’m trying to merge JSON results from an API call in with ActiveRecord
results for a blended display in a view. I’d like to be able to merge
the two result sets based on ''created_at'' which is is common in both
the ActiveRecord results and the JSON results from the API. Created_at
is the only common element between the two data sets.
Here’s what I have in my controller
2024 Oct 30
1
Extracting wind direction and wind speed from wind rose plot
A wind rose plot omits time information. Your request is simply not possible.
On October 30, 2024 3:48:03 AM PDT, javad bayat <j.bayat194 at gmail.com> wrote:
>Dear all;
>I am searching for a way to extract wind direction and speed from a wind
>rose plot. I have a graph and I want to make a dataframe of 5 years with
>hourly intervals.
>
>> start_date <-
2006 Jul 21
1
Partial, Table Layout, Multiple Controllers/Models... DRY?
Hi,
I am almost embarrased to ask this and I am sure it has been answered
previously but the search feature is down on ruby-forum so I am not
finding the answer.
I have several controllers (leads, orders, activities, etc...). I have
a ton of repeated html in each of the views for these controllers. For
example, my list view has the same table/tr/td and for..in type of code
and it just