Displaying 20 results from an estimated 2000 matches similar to: "Inserting NULL values into PostgreSQL from Rails"
2006 Jan 17
6
Rails Best Practices Page
Hey,
I have been progressively learning more and more rails each day
(from both a current project, reading the agile book, and this list).
Does anybody think it would be beneficial to have kind of like a rails
"Best Practices" page that lists some of the better ways of handling
certain functions of rails (that are common in most apps) that are
both more elegant, and efficient.
For
2006 Jan 31
2
Need advice on RoR app design
Fellow Railers,
Is there anything, anywhere, that I can read that discusses overall RoR
app design? I have the Agile RoR book, which is great for learning the
details of RoR, but unfortunately doesn''t cover the overall issue of
creating a large, complex RoR app.
My staff and I are still in the process of getting up to speed on Ruby
and RoR, but we also need to begin thinking about
2006 Jan 30
1
auto_complete_with_index_for
I have a crude hack to allow auto_complete to work with indexed text
fields. I needed it for a timecard entry form with an arbtirary
number of records which can be added/changed/delete willy-nilly by
users. One of the fields is a perfect candidate for autocomplete
since it references a database object with a large number of choices
and long descriptions. Using a select list is extremely ugly in
2006 Feb 01
4
Locking out users from certain records/urls
I am using the standard login controller that ships with RoR to
authenticate users in my application. In my app, Users belong to
Clients, Clients have Projects that users are assigned to (stored in a
stakeholder table with user_id and project_id columns) , then each
project has a bunch of folders and assets (file uploads).
So currently I have urls that look like /project/show/12 etc. I want
2006 Jan 31
19
Best Practices: Escaping text on input or output?
In web applications that have user generated content, it is clearly
necessary to provide some ability to ''escape'' user generated text to
avoid SQL injection, XSS, and other nasty attacks. The existing dogma
on this point seems to favor escaping text as it comes out of the
database, rather than doing it on the way in.
I''m not sure that I understand the logic behind
2006 Jun 26
2
text_field weirdness?
I''m storying amounts of money in my database as cents.
So I have custom accessors in my model, for example
def actual_amount
read_attribute("actual_amount").to_f / 100.0
end
But when I use
<%= text_field ''item'', ''actual_amount'' %>
I get, for example, "3600" instead of "36.00".
If I ignore the helper, and
2006 Jan 19
5
TIP: Using field_error_proc to add style attributes to form elements
I just put this up on the wiki, and thought I''d share in case it''s
useful to anyone else. This is handy if you don?t want to wrap your
input elements inside a div when an error occurs, but instead want to
add some sort of CSS style to fields with errors:
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
msg = instance.error_message
error_style =
2006 Jul 02
7
How can I intercept attribute calls?
Hi.
I have two types of fields in my database, e.g. "name" and "name_ru".
First one is a user''s name in english and the second one is in russian.
I want to intercept calls like "c.name" and add "_ru" to it if current
language is russian (I have my own Locale class like n Globalize).
So I want such thing:
--
Locale.set("en-US")
c.name
2006 Jan 02
19
AR: How to store and restore in YML.
Hello-
I have a database with entries that are segmented by customers. I would
like to be able to store / delete / restore a particular customer''s
information. I will need to rebuild the rows on restore and also
rebuild the associations for the different tables.
For example,
customer {
id
name
}
companies {
id
customer_id (belongs_to)
name
}
contacts {
id
2008 Jul 02
0
before_type_case broken?
Hey,
I''ve noticed that I seem unable to get a _before_type_cast value for
dates in 2.1. Specifically, if I assign a date string to a date
attribute, and then call attribute_before_type_cast I get a TimeWithZone
instead of a String:
model.start_date = "2001/01/02"
model.start_date.class = ActiveSupport::TimeWithZone
model.start_date_before_type_cast.class =
2006 Jul 31
3
PostgreSQL, postgres gem, rails2.pdf, http://ruby.scripting.ca/postgres/ confusion...
Hello people...
In the rails2.pdf Dave T says:
Rails works with the DB2, MySQL, Oracle, Postgres,...
The database drivers are all written in C and are primarily distributed in
source form.
Then he lists this site:
http://ruby.scripting.ca/postgres/
Then he says,
There is a pure-Ruby version of the Postgres adapter available. Download
postgres-pr from the Ruby-DBI page at
2006 Jul 16
4
migrations questions: MySQL -> postgreSQL
I started my app before migrations were a best practice and have been using SQL scripts. Now I''m looking at potentially having to move from using MySQL to postgreSQL to use a particular hosting provider. I understand migrations are the way to go to make this ''easy'' but it also looks like the use of migrations introduces extra work in other areas. I''d really
2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on
this, I think it''s time to ask the list.
Postgres stores a Date in YYYY-MM-DD format. My users want the dates
in MM/DD/YYYY format.
Sure, I could explicitly convert it on the app level every place where
a date is displayed, but that seemed like a DRY violation.
I thought I''d be clever and simply
2005 Jan 19
2
Policy after fsck fixes errors
Hello,
Yesterday evening this box crashed and, for once, ext3 was
not able to recover automatically. There was an
"unexpected inconsistency inode xxxxx has imagic flag set"
error and the system would not boot. I fscked from my
rescue disk and I guess 20 or 30 errors were fixed by me
just selecting "y" at the prompt.
The system then booted and, so far as I can tell, the only
2006 Mar 02
1
PostgreSQL function in an insert statement
Hi there,
I wont insert a picture in a PostgrSQL-DB via the function lo_import.
Therfore I modify the value of an ''oid'' column.
@measurepoint = Measurepoint.new(params[:measurepoint])
@measurepoint.measurepoint_background = "lo_import(''#{@params[''measurepoint''][''measurepoint_background'']'')"
@measurepoint.save
The
2011 Dec 15
1
Quota PostgreSQL INSERT trigger
Wiki instructions for creating insert trigger for PostgreSQL are wrong
http://wiki.dovecot.org/Quota/Dict
Calling INSERT on the table from within BEFORE INSERT trigger creates
cascading trigger.
http://www.postgresql.org/docs/current/interactive/trigger-definition.html
Instead, one should return NEW record from the trigger, and it will be
inserted after trigger execution.
---
CREATE OR
2005 Jun 16
3
PostgreSQL Scaffold Doesn't Insert PK?
I am new to Rails and Ruby. I''ve been a WebObjects developer for a few years
and before that J2EE (shudder). I wanted to try RoR so I am porting an
existing Web app.
I am running the latest release on Tiger and PG8.
Right now my single table has three attributes:
id | integer | not null
hotel_name | character varying(255) | not null
hotel_location |
2004 May 25
0
authentication failure (?)
I have a domain member samba server set up with winbind
and compiled with acl support sharing out an ext3 filesystem,
also with acl support. Some bits of smb.conf (with names
changed to protect the innocent):
---
[global]
workgroup = XYZATL
realm = XYZ.COM
security = domain
password server = *
winbind separator = +
idmap uid = 10000-65000
idmap gid = 10000-65000
winbind enum users = yes
2007 Jan 19
3
if else statement
Hello,
I'm doing some scripting and I've noticed that R doesn't seem to
have an
if (cond){
do
}ifelse (cond) {
do
} else {
do
}
type block.
Is this correct or am I missing something.
THX
Paul
--
Research Technician
Mass Spectrometry
o The
/
o Scripps
\
o Research
/
o Institute
2006 Nov 29
3
better define: matrix comparison and cbind issue
Hello,
Sorry to all for the lack of communication, and thanks to those with the
suggestions.
So I have two matrixes which are different sizes, same column number but
different row number.
What I would like to do is to compare A to B. In the 6 and 9th column there
are ref numbers (molecular masses to be exact). I would like to check A and
B by these columns. If I find that the number in A[9,x]