Displaying 20 results from an estimated 800 matches similar to: "complicated search/model question"
2006 Jun 12
2
date_select() in collection
Hi,
I am doing the following:
<% obj.contracts.each do |@contract| -%>
...
<%= hidden_field("contract[]", :contractor_id, :index =>
@contract.contractor.id) %>
<%= date_select("contract[]", :starting_on, :index =>
@contract.contractor.id) %>
...
<% end -%>
Here are the request parameters:
{"commit"=>"Save",
2010 Oct 06
2
reflect_on_association method
Hi all, I am having trouble trying to use reflect_on_association
method with given the simplified model:
class Order < ActiveRecord::Base
belongs_to :contractor, :class_name => "BusinessUnit"
end
I expected the reflect_on_association method to return
associated_foreign_key "contractor_id" but it returns
"business_unit_id":
ruby-1.9.2-p0 >
2005 Jul 18
0
Netowrk addresses contactor
Does anyone know how to control electrical load remotely using Linux?
I'm thjinking a network addressable contactor (200 Amp) but I have not
been able to source one.
--
Chris Mason
NetConcepts
(264) 497-5670 Fax: (264) 497-8463
Int: (305) 704-7249 Fax: (815)301-9759
Cell: 264-235-5670
Yahoo IM: netconcepts_anguilla at yahoo.com
2006 May 19
2
Problems with belongs_to table joins
I am looking for a little assistance with a problem I have with a simple
table join using Rails. I am a relative newbie to both Ruby and Rails so
any help would be greatly appreciated . I have two tables products and
product_formats.
create table products (
id int not null auto_increment,
title varchar(100) not null,
product_format_id integer
2006 Apr 22
1
Newbie question about using helpers in controllers
I''m trying to display a list of pages in xml. I want to change
page.update_at to distance_of_time_in_words_to_now. However whenever I
run it I get an error saying:
undefined method `distance_of_time_in_words_to_now''
I know I can just go the rails api and copy the source, but there must
be another way.
def list
@page = Page.find(:all, :order => "updated_at desc")
2006 Jul 31
0
Polymorphic has_many association through a belongs_to
Hi,
Let''s say I''ve the following Models and their relative associations:
Seat
----
belongs_to :booking
Booking
-------
has_many :seats
has_many :debits, :as => :chargeable
Debits
------
belongs_to :chargeable, :polymorphic => true
Why
>> seat.booking.debits
nil
while
>> Booking.find(seat.booking_id).debits
[]
?
Thanks.
Cheers,
Marco
2008 Jul 12
0
to_json in Rails 2.0.2 not generating proper json?
I am using Rails 2.0.2 and trying to use to_json to generate json. I
notice several problems.
1) datetime field such as created_at mapped to "created_at": {}
2) :except does not work, @post.to_json(:except =>
[:created_at, :updated_at] still gives me "created_at": {},
"update_at": {}
3) problem with escaped char mapping: ''<'' mapped to
2003 May 06
0
supply electric appliances
From:Mr Sander Yuan, G.Manager
Chnze Electric Equipment Co.ltd.
No.17-505 Lumingyuan Lucheng Industrial zone Wenzhou China 325007
Fax:86-577-88776860 Tel:86-577-88776861 or 88776862
E-mail:qunze@mail.wzptt.zj.cn chnze@mail.wzptt.zj.cn
http://www.chnze.com; http://www.electricbase.com
Dear Sir,
We are pleased to introduce ourselves as leading manufacturers and
exporters in
2006 Feb 08
1
Weird validation issue
Hi,
I''m having a weird validation issue. Validation isn''t working for
certain attributes and, for some reason, it''s also affecting things
outside of validation.
For campers on certain camp types, we require some information about
their school. I tried to validate the information this way:
validates_presence_of :school_type, :if => Proc.new { |c|
!c.booking.nil?
2006 Jun 14
2
rjs issue with Internet Explorer
Hi,
When executing some rjs templates:
page.insert_html :bottom, ''contractors'', :partial => ''contractor''
page.visual_effect :highlight, "contractor#{@contract.contractor.id}",
:duration => 1
Works fine on Firefox, but nothing happens on IE. Is there any
equivalent of Firebug for Internet Explorer? Are there "well-known" tips
for
2017 Nov 09
1
weighted average grouped by variables
Hello,
Using base R only, the following seems to do what you want.
with(mydf, ave(speed, date_time, type, FUN = weighted.mean, w = n_vehicles))
Hope this helps,
Rui Barradas
Em 09-11-2017 13:16, Massimo Bressan escreveu:
> Hello
>
> an update about my question: I worked out the following solution (with the package "dplyr")
>
> library(dplyr)
>
> mydf%>%
>
2005 Sep 19
3
[resend] [patch] driver for Eltek AL175 alarm module
Hello up there!
Attached is my patch to add support for AL175 alarm module,
Please ACK or NAK this.
--
?????? ???????
-------------- next part --------------
A non-text attachment was scrubbed...
Name: al175.patch
Type: text/x-diff
Size: 35632 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20050919/84b639e0/al175-0001.bin
2006 Jun 29
1
Newbie: Help Please - Model Validation Error
Hi,
I''d be grateful for your help.
I get the error (see below) everytime I add the
following into a newly generated (via scaffold) model
class:
validates_presence_of :myname, :mymessage, :mytel
Without it, I can insert records into my database.
With it, I get the error :(
ERROR>>
ArgumentError in AdminController#create
wrong number of arguments (1 for 0)
RAILS_ROOT:
2017 Nov 09
1
weighted average grouped by variables
Dear Massimo,
It seems straightforward to use weighted.mean() in a dplyr context
library(dplyr)
mydf %>%
group_by(date_time, type) %>%
summarise(vel = weighted.mean(speed, n_vehicles))
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team
2010 Mar 17
2
How can I return rows from a data frame with maximum value by factor?
Hi,
I'm new to R and new to this forum. I'm struggling with trying to extract
certain rows of data from my data.frame. The data.frame has eleven columns.
Among those columns are "FISH_ID" and "DATE_TIME". FISH_ID is a factor. For
each of my 21 unique FISH_IDs (levels) I have a few to a few thousand rows,
each row with a unique DATE_TIME value. I would like to obtain,
2006 Jun 15
3
Can I call MySql statements directly??
Hi All.
I have a mysql statement that I would really really like to call from my
Ruby program which goes like this:
SELECT a, b, DAYOFWEEK(date_time) as DOW,
HOUR(date_time) at hr,
AVG(x/y)
FROM records;
This is possible by creating a 3-dimentional array of a, b, date_time
containing x/y, and then finding averages and putting it into a
4-dimensional array of a, b, dow,
2006 Feb 08
1
Possible AGI Bug in Asterisk?
Dear All,
I seem to have stumbled across an AGI problem;
I have written an AGI Script (bottom of this email);
The script does the following;
Makes a CDR entry when called
Records the call
Updates the CDR
Finds a corresponding DNIS from the SMDR table (captured via a serial
port logger)
Matches up the record and updates the CDR.
The script works perfectly in my test lab and has been doing so
2009 Oct 06
1
ggplot2 applying a function based on facet
Look at the bottom of the message for my question
#here is a little function that I wrote
USGS <- function(input="discharge", days=7){
library(chron)
library(gsubfn)
#021973269 is the Waynesboro Gauge on the Savannah River Proper (SRS)
#02102908 is the Flat Creek Gauge (ftbrfcms)
#02133500 is the Drowning Creek (ftbrbmcm)
#02341800 is the Upatoi Creek Near Columbus (ftbn)
#02342500 is
2008 Mar 17
0
arules - getting transaction data in
Hi All
Hoping someone can help me with the "transactions" object. I am struggling
to get my data in. I know the answer is in the help somewhere I'm sure, I
just cannot find it. Essentially, I have data in this format (though I can
change it if it particularly unsuitable)
Transaction_id, store , salesman, date_time , items
1 , waterfront, john ,
2006 Feb 20
9
a complex availability problem
Ok, this is a hard one and I just thought I''d see if people on the
list had any suggestions on how they would approach this, I''ve not
started to implement the rails to handle this yet as I''m still at the
paper planning phase.
I''m building an app that has to handle availability for travel packages.
The complexity comes in that a person can choose a start