Displaying 9 results from an estimated 9 matches for "acts_as_enumerated".
2006 Jun 18
10
acts_as_enumerated
Hello All,
Any one using acts_as_enumerated? I need help using (I like that it
caches values in memory)
I am working on a dating website and there are lots of options I want to
store as enumerated like
Status; divorce, single,
Sex: male, female
Eye color; blue, brown, green....
and lots more....
But I do not wanna keep them in seperate...
2006 Aug 05
2
plz do favour in active record
hello
I want to do like the below code
name=[''net'',''gross'',''amount'']
avail= Avail.find(1)
return avail.name[0]
but it gets error
I want to give " avail.name[0] " like this, rather than avail.net
directly,
can u guys plz help me, how to do this plz explain with code
advance thx
have a pleasant day
narayana
--
2008 May 22
14
Specifying certain tables NOT to be cleared each example?
...specify that certain tables not be cleared on each
example.
I''ve inherited a project where a good amount of enumerated data is
stored in the database (US States, statuses, about 15-20 tables worth.
Over all, it''s a reasonable decision that leads to solid production
code (acts_as_enumerated is good). This data is read-only and
relatively static; any changes to these tables are done via migrations.
The problem comes when I''m writing my tests. Obviously all these
tables get wiped with each example. Yes, I could specify these as
fixtures, but I really don''t want...
2006 May 10
12
how best to implement lookup table?
Hi all -
I''d like to implement a lookup table in my app that contains some
reference data, just some status codes and their descriptions. What''s
the most appropriate approach according to the "rails way" of doing
things? Would I just implement a has_many relationship? Let''s say
these are Order status codes, would the StatusCode have many Orders?
This
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 Jun 26
5
How can I dynamiclly generate models?
I am trying to write a plugin, ''acts_as_commentable'', for my models -
Image, Book, Music and so on, I do not want to use polymorphic
association, so very model should have its own comment class.
Here is my code
acts_as_commentable.rb
module Commentable
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def
2006 Nov 08
3
How to implement status codes in DB and Rails
This is more of a design issue I''m wrestling with, and was wondering
what other people are doing.
I have a products table with status values of In Stock, Out of Stork or
Discontinued. This is unlikely to change any time soon.
Approach A, is to have thses actual values in the status column, at
least the meaning is very apparent, yet querying for products with a
specific status could
2006 Jul 19
11
Getting data from the database only once
Hi,
I am a little bit new to ruby. I have a requirement that I need to
get the data from the database. I need to do this many times in the
whole application. But, I am looking for a way with which I can get the
data from the database table only once and store it in some variable,
and I can use it anywhere I want.(I am trying not to use the global
variable for this purpose). Is there a way
2006 Mar 23
8
DRY principle - how to implement?
Hi all!
I have ''send_status'' table which looks something like these:
id code title
1 sent Sent
2 error Sending error
3 success Success
Next I would like to associate some processed records with their
''send_status''. Is it better to use:
1)
record.status_id = SendStatus.find(:one, :condition => "code=''sent''").id
to