Displaying 20 results from an estimated 10000 matches similar to: "limit user input for legacy coding schemes"
2006 Jul 12
5
DRY version of RoR book PAYMENT_TYPES example
In the book there is an example how to convert DB payment value to more
readable from. PAYMENT_TYPES array is defined and then in your views you
can use it as Order::PAYMENT_TYPES.
The problem is: how should I convert DB values (for example with type
char(1)) to full string representation. I know that I can add a Hash to
a model: IM = {''S'' => ''Skype'',
2006 Jan 28
1
Collection_select problem
I have my customer object with title attribute
: @customer.title
Where title is "Mr","Mrs", etc....
In edit/create from i have:
@titles=["Mr","Mrs","Miss"]
how do i create a selection box that sets itself to the value of
@customer.title??
This doesn''t work:
<%=collection_select(:customer, :title, @titles)%>
Any help would be
2006 Jul 13
10
Book Question on RoR
Hi there,
I am a newbie and interested in learning Ruby on Rails. I see there are
2 books out there:
Ruby for Rails
Ruby techniques for Rails developers
David A. Black
and
Agile Web Development with Rails : A Pragmatic Guide (Pragmatic
Programmers)
Dave Thomas, David Heinemeier Hansson, Andreas Schwarz, and Thomas Fuchs
Which one should I get? "Agile Web Development with Rails"
2006 Aug 04
5
Any opinions on the Rails [Rough Cuts] books from Safari
Either -
Ruby on Rails: Up and Running or
Rails Cookbook
I''ve heard so many negative things about Safari pdf''s and the whole
program I''d like to get some feedback.
I have AWDWR(2nd edition), RubyforRails(Manning), Programming Ruby(2nd
edition), so I''m not even sure I actually need another book but maybe
the approach or content is somewhat uniuqe.
TIA
Stuart
2006 Jul 21
20
New version of AWDwR
Folks:
I''ve uplaoded the B1.05 version of AWDwR. It fixes a number of
reported errata (and a few that weren''t reported :), and
adds two significant changes:
1. It now uses the new Active Record decimal -> BigDecimal
conversion. I''ve personally been waiting for this for a long
time, and I''m really happy it''s now part of core. However,
2006 Aug 08
1
Legacy system belongs_to problem
Hi all,
I am trying to patch a small rails app into a large system we have at
our company. The legacy has a large database that naturally does not
match the Rails conventions, but this has not been a serious problem
thanks to rails flexibility.
The problem I just ran into is that my "LineItems" table links back to
the "Products" table using a modified foreign key. For
2006 May 05
11
Rails Recipes or AWDWR 2 ?
Hi,
I bougth the Agile Web Development with rails First Edition and now want
buy rails recipes but what is the best decision buy rails recipes or the new
edition de Agile Web Development With Rails?
Jean Carlo Schechnner
www.idvirtual.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 May 11
7
Rails in Dr. Dobbs Journal ?
Hi,
I''ve read that Dr. Dobbs Journal''s last issue has a cover article about
Rails titled "Ruby On Rails - Java''s Successor?". Can''t find anything
about it in http://www.ddj.com
Does someone have the paper edition and can confirm that, and tell
how the article looks like, and so on.
Thanks,
-- Jean-Fran?ois.
--
? la renverse.
2006 Sep 29
1
Rails validation scheme: why not validate params directly.
Hi. There are many ways of doing validation but I''m trying to think of
the cleanest way without making the action code unclean. Would it be
advisable to do validation on the incoming params hash rather than
waiting to setup an object you are about to save and calling ojb.valid?
before saving? Or even going as far as trying to save the object but
failing from the model''s
2006 Jul 16
7
form_helpers ?
Just a quick silly question , are form_helpers actually helper.rb files ?
Stuart
2006 Jul 22
4
Reading floating points into a field stored as Integers
Hi, I''m trying to follow the "AWDR" example of storing certain types of
numbers (in my case, percentages not money) as integers in the
database. I understand from the Depot application how to format the
output to have 2 places (or n places for that matter) decimal.
Now, I"m wondering about the input. It''s more natural for people to
enter numbers as
2006 Mar 16
6
How to have multiple fields appear in collection_select?
I have a table of employees with the fields "last_name" and
"first_name". I would like to populate a collection select so that what
the user sees in the drop-down is "Last Name, First Name". So far, the
only way I have figured out to do this is by using "find_by_sql" in my
model, like so:
@employees.find_by_sql("SELECT id, concat(last_name,
2006 Jun 20
2
habtm, multi select, and validation
Greetings -
I''m trying to find the most efficient, "Rails" way to solve the
following problem. It''s in two parts, but I think the solution is
somewhat related:
I have Recipe and Category model related by HABTM. I would like to
1.) Validate the *number* of categories associated with a recipe, say a
minimum of 1 and a max of 3. (So validates_associated will not
2006 Apr 05
5
when is model() needed?
I have just some vague and thus probably wrong ideas about when to
use model() in controllers, and by now I err on being redundant. I
don''t post them here to avoid leaving anything that may be false in
the archives.
Can anyone explain exactly in which cases one should use model()?
-- fxn
2006 May 31
19
Rails Deployment: Book recommendation?
Hello,
I''m seeking a book on rails deployment (I think a general deployment
on nix book can helps too)
I need in depth information about Apache, FastCGI, (LightTPD maybe).
I was thinking always I know what a web server is! but when I think
more deeply about it (after reading Capistrano doc) it seems I need
more info about app, web and db servers. stuff like how to config the
app server
2006 Jan 22
3
dumping out mysql data only (no structure)
Is it possible? It is mentioned in AWDWR but I cannot find that
option in the MySQL documentation. I can dump the whole db or just
the structure, but I''d like to be able to dump just the contents.
bruce
2006 Mar 07
17
Handling Erros from AWDWR
I''m getting to the point now where I really need to start trapping the
errors.
So from my AWDWR book, I added the following directly from the book into
application.rb...
def rescue_action_in_public(exception)
case exception
when ActiveRecord::RecordNotFound, ActionController::UnknownAction
render(:file => "#{RAILS_ROOT}/public/404.html",
2006 Jun 10
7
Agile Web Development with Rails Page 33
I''m a real Newb; just bought AWDwR and using it with Win2000 - it took me
ages, and only after reading Curt Hibbs Rolling with Ruby, to realise that I
needed to use Cmd.exe before using AWDwR''s dave> instructions.
I''ve created Say/hello.html and I still get "Template is missing" with
http://localhost:3000/say/hello
I''ve read
2006 Jul 24
9
Mongrel: auto-reload plugins?
When developing applications, Webrick will automatically reload
controllers, models, etc. if the source changes. For obvious reasons, it
doesn''t do this for plugins, which makes it a pain to develop said plugins.
I was hoping Mongrel might have some facility to say "watch this directory
too and reload any changes". Obviously, re-init''ing all plugins would be
2006 May 21
3
Where to put partials called from the application layout
Hello,
My main application layout, app/views/layout/application.rhtml looks
like this:
something
render partial_1
something else
render partial_2
something else
render partial_3
The partials are not really doing anything, i use them to keep the
layout modular (i.e . to have ~30 lines instead of 200). Now, the
question is where to put _partial_1.rhtml, _partial_2.rhtml,
_partial_3.rhtml.
If i am