Displaying 20 results from an estimated 1000 matches similar to: "Dropdown with concatenated columns."
2011 Jul 11
36
has_many and belongs_to association
Hi ,
I want to test the one below but I got the problem
belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
in my test
context "test"do
should have_many :phrases
end
in language.rb
belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
error is
1) Failure:
test: check has_many and belongs_to
2006 Jul 16
6
using collection_select
hello,
supposing i have a User class that contains a Wibble
class User < ActiveRecord::Base
has_one :wibble
end
in my view i have
<%= collection_select :user, :wibble, Wibble.find(:all), :id, :name %>
when i post, i get an error like
"Wibble expected, got String"
how/where am I supposed to convert this posted wibble_id into a
Wibble, or am I using collection_select
2006 Mar 19
4
Trouble with composed_of
I''m trying to use composed_of within my model. I have a field in my
database named ''card1'', which is simply a string. I have this in my
model
class Player < ActiveRecord::Base
composed_of :card1, :class_name => ''Card''
end
class Card
attr_reader :value, :suit
def initialize(s)
@value = s[0].chr
@suit = s[1].chr
end
end
The
2006 Feb 28
12
Examples for Money library ?
Can anybody share some examples of their Money implementation ?
I''m trying to setup a Model to use this library, but can''t seem to wrap my
head around how it is exactly supposed to work.
My Model (Foo) looks like:
===============
composed_of :commission, :class_name => "Money", :mapping => [
%w(commission_cents cents), %w(commission_currency currency) ]
Yet, in
2005 Dec 16
4
Validation with Aggregation
ActiveRecord supports composed_of for value objects which is
fantastic but one thing that it doesn''t seem to support (or at least
I am unable to find any documentation for) validation of the value
objects.
For example, given the following:
class Message < ActiveRecord::Base
composed_of :sender, :class_name => ''EmailAddress''
composed_of :recipient,
2009 Dec 16
2
Flexclust barchart issue when mcol=NULL (PR#14150)
Full_Name: Chris Hane
Version: 2.10.1
OS: Windows
Submission from: (NULL) (198.203.181.181)
When using barchart in the flexcust package, setting mcol=NULL to avoid the
lollipops causes an error. Each panel shows the text message "Error using
packet n replacement has length zero." where n is the panel number.
> data(iris)
> cl <- cclust(iris[,-5], k=3)
> barplot(cl,
2006 Mar 23
4
belongs_to more than one model
Suppose I have one table:
states
id
statename
And I have two other tables that contains states:
houses
id
color
state_id
places
id
place_name
state_id
How would my model relationships look like?
class State < ActiveRecord::Base
belongs_to house
belongs_to place
end
class House < ActiveRecord::Base
has_one state
end
class Place <
2006 Jan 06
4
Are migrations executed within a transaction?
Hi all,
Can I safely assume that each migration is excuted within a
transaction, so that''s it''s safe to have migrations executing failing
statements?
Thanks,
- Rowan
--
Morality is usually taught by the immoral.
2008 Sep 28
2
passing variable between methods
How can I pass @member varible from def member to def name and insert it
into name_id? These methods are in the same controller.
def member
@member = params[:member] || ''''
member = @member
end
def name
name_id = @member
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2005 Dec 17
1
How to use validation with aggregation (composed_of)?
At the risk of being banned for posting the same question twice, I
thought I''d try once more with a question for the title rather than a
statement (on the basis that perhaps questions get answered and
statements ignored ;-) )
ActiveRecord supports composed_of for value objects which is
fantastic but one thing that it doesn''t seem to support (or at least
I am unable to
2006 Jul 13
1
Incorrect composed_of I think
I am trying to use composed_of in my model, but I not succeeding.
With the code I pasted below, I cannot perform this action in the console:
property = Property.new(1, "px")
I get NameError: uninitialized constant Property when I try to perform
that action. It''s not finding my class I made I suppose. The Property
class is in the same file as the Element class, element.rb.
2008 Jul 17
5
Memory Ballooning / Overcommitting
I have a xen server setup that I want to install a lot of vms on if
possible. The vms will have no utilization for the most part; and brief
utilization when active. The server has 2GB of RAM.
We were running into a problem were the dom0 would not let us add anymore
vms because we were out of physical memory.
I have started to read about memory ballooning and hoping someone could
point me
2006 Jun 28
6
select_tag
in my controller
@cursos = Curso.find_all
in my view i''m trying to do a select_tag with the results @cursos, using
a helper
select_tag "name" options_for_select(@cursos) --------> not works
select_tag "name" @cursos --------> not works
how to do it, using the helper?
tks
--
Posted via http://www.ruby-forum.com/.
2006 May 08
2
Creating a "Foo has_many bars" association where bar isn''t a model.
Hi
Let''s say we have model Foo. Each Foo instance can have several bars.
Those bars are primitive, so they shouldn''t be models. For example,
Foo might be a type of convention, and the bars might be years the
convention was held in. Naively, we would have a conventions_years
date, and put:
has_many :years
inside class Convention. But then we''d get an error, since for
2006 Jul 13
2
Simple dropdown menu
Hi, I''m quite new to this language and I''m having trouble finding out
simple things like a dropdown menu in rhtml. I know I have to use <%
select_tag %> but I''ve read lots of different ways to put in the options
so I''m a bit confused. Options are hard-coded for the menu I''m trying to
create so no database is involved!
Thanks v much!
Bex
--
2009 Nov 18
2
Composing Data from THREE models with Aggregation
Hello! I''m looking for assistance EXTENDING an example from the Agile
Web Development With Rails book: Composing Data with Aggregation (page
324).
I''m trying to map three columns to a single Ruby object. However,
unlike the example in the Agile Web Development book, the three
columns I want to map into one object come from THREE DIFFERENT
models.
I want to map the following
2006 Jan 14
3
Reducing echo on FXS port
Hello everybody,
I am sorry to bring this up again if this kind of echo issue has ever discussed.
Phone2 in below call path experiences quite annoying echo:
Phone1 --> FXS (TDM400P) --> Asterisk --> SIP GW --> PSTN --> Phone2
It is annoying as on phone2, we can hear the whole words we say with the level of maybe 25% of the original sound. I can reduce the echo to maximum with
2006 Nov 04
1
Pass through
Hi!
I want to tell asterisk to simply pass-through any codecs that my phones
support. I have to use codecs that are not popular and implemented by a
third-party, asterisk has nothing to do with them.
I've made a test with g722 (that asterisk doesn't support), i've set all my
two snom 300 phones to support only g722 and asterisk declined the sip
invitation. That is bad for me. Is it
2003 Nov 07
2
No ringing tone
I have the following setup:
AnalogPhone1--TDM400P-ASTERISK---via SIP---Softswitch--------POTS Phone2
When I call from AnalogPhone1 to Phone2 I hear a ringing tone and all is well.
When making a call from Phone2, I get a dial tone but after dialing the number
I hear nothing (no ringing tone). On Asterisk console it says that a call is
coming in and that it is ringing Zap/2. I can also hear the
2004 May 09
2
Help with initial setup
Hi,
I've have followed through the help docs in trying to get an initial setup
going with two phones and the asterisk server. Firstly, all I'm trying to
do is get the two phones actually talking to one another VIA asterisk..
I've added this to sip.conf:
[phone1]
type=friend
host=dynamic
defaultip=192.168.1.106
;username=blah
;secret=blah
dtmfmode=rfc2833 ; Choices are inband,