Displaying 20 results from an estimated 20000 matches similar to: "Quoting table and column names inside AR"
2006 Jan 19
7
validates_numericality_of positive integer
Hi,
What is the simplest way to validate a positive integer?
validates_numericality_of :foo, :integer_only => true
how do I add the positive part? Do I need another validation statement
for pattern matching or do I have to write a validate() funciton for
my model?
Thanks,
Peter
2006 Jan 27
17
Multiple Model Validation
Hey All !
I have a form which contains two models. I would like both models to be
validated, but have their validations aggregated on the page.
If I do:
<%= error_messages_for(:model1) %>
<%= error_messages_for(:model2) %>
It puts two big validation blocks on the page. I would like all the errors
from both models, but only in one validation box.
Is this possible ? All my attempts
2006 Apr 22
4
How to supress field name in error message?
Hi
How do I supress the reporting of a field name in the full error
message? I want the error to be associated with the field so that the
.fieldWithErrors class is applied to the field but I don''t want it to
add the field name to the actual error message.
For example:
errors.add("occurs_on", "The date can''t be today!") unless occurs_on
!= Date.today
I
2006 Feb 28
5
Session Sweeping
Hi,
Anyone got some slick ideas on how to sweep an AR session store? I have a
few ideas how I can do it, just want to see if there is an elegant solution
that someone is already using.
Bob Silva
http://www.railtie.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jan 20
8
validates_confirmation_of not working
is there any special requirement for validates_confirmation_of ? I am
trying to make sure 2 passwords are equal (cleanly the rails way)..
In my view i have two fields with id user[password] and
user[password_confirmation].
in the model i have
validates_confirmation_of :password, :message =>"Passwords do not match "
Am i missing something here ?
thanks
adam
2005 Dec 14
3
why would an int column in a join table be a String class in model?
i''ve got an issue with integer columns in the database becoming strings in
the model and I''m not sure why this is happening. perhaps someone can
explain.
given the following setup (simplified for example)
tables:
users
----------
id - int
name - varchar(60)
roles
----------
id - int
name - varchar(60)
roles_users (join table)
----------
role_id - int
user_id - int
2005 Oct 03
3
Boolean quoting, postgresql
http://dev.rubyonrails.org/ticket/1117
I''ve attached a patch to ticket 1117 which fixes it so that booleans
are escaped as booleans, not integers. Specifically, this situation
will now work
find_all(["send_date=? and sent=?", Date.today, false])
Which matches peoples expectations, but it causes some problems with
the postgresql unit tests. Specifically, the use of
2006 Feb 07
9
Is there a good time_select tag helper?
I''m trying to record a list of start and end times, and they''re simply
an hour and a minute. Looking at the API, there''s a select_time
helper, but that just creates the tag. There''s a datetime_select
helper which takes an object and method name, so it does all the
magic...but I only want to worry about the hour and the minute. I''ve
tried writing my
2006 Apr 04
4
Ruby 1.8.4 on SUSE 10.0 howto
All,
I just installed ruby 1.8.4 on my SUSE 10.0 box. It was slightly
convoluted so I thought I would post the solution here.
Once this runs for a day or so I will try upgrading my rails to 1.1
=== Ruby 1.8.4 on SUSE 10.0 Howto
I downloaded the src.rpm from
http://mirrors.kernel.org/opensuse/distribution/SL-OSS-factory/inst-source/suse/src/ruby-1.8.4-9.src.rpm
Then I installed it with
2006 Mar 04
4
authorization framework?
There are a number of good authentication frameworks for rails - has anyone
developed a generic authorization framework?
I''m thinking of something that included the concept of roles, mapped roles
to both actions and users and could be used to wrap actions before their
invocation.
Extra good would be some way to check data permissions (as in, "yes you can
perform the ''Edit
2006 Jan 30
11
Database Selection
Hi,
I am a RoR newbie and I''ve been experimenting with different databases
(mySQL, PostgreSQL, etc.) and different table types (MyISAM vs. InnoDB).
Is there a preferred database/table type for RoR development. I like
how MySQL''s InnoDB tables enforce referential integrity, but these
tables require a lot more storage space then MyISAM tables.
For everyone with a lot of RoR
2006 Apr 26
4
Adding a column to a table
This is a real newbie question with what i''m sure will be a simple answer...
If i add a column a table (in a development application), how do i
update my models to reflect this change?
Cheers,
Steve
2006 Mar 13
0
Getting AR to downcase table and column names
I''m looking for the cleanest way to force the Rails framework to use a
lower-case version of the table and column names in a database when
creating records.
I need this for a Rails application that displays the status of an
existing backup system. The backup system (Bacula; Nice backup
system, BTW) can use either Postgres or Mysql as its database engine.
Unfortunately, the table and
2006 Jan 27
4
testing for nil numeric value in find
In the agile/rails tutorial book the following construct is added
to products.rb.
def self.salable_items
find( :all,
:conditions => "date_available <= now()",
:order => "date_available desc")
end
Now, I wish to extend :conditions => to exclude products that have
a nil value for the price. I have tried different syntax
2006 May 25
0
Quoting column names, postgres and legacy databases
Hi
I''m building a Rails app that intereacts with several legacy databases,
all on Postgres 7.4 and running into a few quirky problems.
I seem to have a lot of inconsistencies w/ quoting field names in
Postgres. I''ve written another app from scratch using Postgres and
encountered quoting trouble there too. But it seemed tied to the machine
I was serving the app from.
2006 Jan 24
5
Password fields and security?
Hi all
I wanted to ask why Rails'' password_field helper uses the input password
as default value when reloading a form because of errors? Isn''t this a
potential security leak? On any other webs I''ve seen so far the password
fields have to be filled in again after every reload of the site so the
password doesn''t exist in plain text in the html code...
What
2006 Jan 09
1
AR: Quoting in Join Model Test
Greetings made men of rails!
I am presently writing a new database adapter for rails to bring the
OpenBase community on board. In working through the rather extensive
AR tests (which I very much appreciate), I have come across a
question I can''t seem to answer on my own.
In the test_has_many_with_piggyback(AssociationsJoinModel) the result
is expected as a quoted integer
2006 May 10
4
Single Table Inheritance problem
I have two tables I am using single table inheritance with: Page and
Item. "Page" has many "Items"; "Item" belongs to "Page".
Item Model:
class Item < ActiveRecord::Base
end
class Article < Item
belongs_to :page
end
Page Model:
class Page < ActiveRecord::Base
end
class Issue < Page
has_many :articles
end
In my controller, when I
2005 Mar 12
3
UTF-8 and AR length validation
Shouldn''t the length validation of AR use String#jsize to be compatible
to UTF-8?
2006 Jan 26
21
pagination_links help
I want append custom query parameters to my pagination links, like
?page=1&foo=bar. I can''t quite figure out how to do this with the
pagination_links helper, although I believe the API says you should be
able to:
pagination_links(paginator, options={}, html_options={})
options are:
:params: any additional routing parameters for page URLs
Has anyone tried this?
thanks,
jeff
--