James Byrne wrote:
>
> I do not know what I am doing wrong either. I tried much the same thing
> as you suggest last night in the console:
Well, whatever I was doing wrong I seem to have fixed it. Things now
seem to be working as I intended.
--
Posted via http://www.ruby-forum.com/.
___
Pat Maddox wrote:
>
> Not sure what your problem is. Here's a gist that demonstrates what
> you're trying to do, and works fine. http://gist.github.com/76667
>
> Pat
I do not know what I am doing wrong either. I tried much the same thing
as you suggest last night in the console:
>> def my_
On Mar 9, 2009, at 1:53 PM, James Byrne wrote:
Pat Maddox wrote:
ActiveRecord doesn't know anything about db constraint errors. If
one
is violated, the error propagates up in the form of an exception.
I realize that, but the exception is of the
ActiveRecord:StatementInvalid class, which I
Just a stab in the dark, but I haven't seen any mention of calling
save vs. save!. save just puts any errors in the model, save! will
raise the exception if there are any errors. That may not be the case
for ActiveRecord:StatementInvalid exception, but I thought i'd
mention
it anyway.
I wond
Tim Glen wrote:
> Just a stab in the dark, but I haven't seen any mention of calling
> save vs. save!. save just puts any errors in the model, save! will
> raise the exception if there are any errors. That may not be the case
> for ActiveRecord:StatementInvalid exception, but I thought i'd mention
ActiveRecord doesn't know anything about db constraint errors. If
one
is violated, the error propagates up in the form of an exception.
I realize that, but the exception is of the
ActiveRecord:StatementInvalid class, which I should be able to catch
in
the controller with a rescue clause.
On Mar 9, 2009, at 4:53 PM, James Byrne wrote:
Pat Maddox wrote:
ActiveRecord doesn't know anything about db constraint errors. If
one
is violated, the error propagates up in the form of an exception.
I realize that, but the exception is of the
ActiveRecord:StatementInvalid class, which
Pat Maddox wrote:
> ActiveRecord doesn't know anything about db constraint errors. If one
> is violated, the error propagates up in the form of an exception.
>
I realize that, but the exception is of the
ActiveRecord:StatementInvalid class, which I should be able to catch in
the controller wit
ActiveRecord doesn't know anything about db constraint errors. If one
is violated, the error propagates up in the form of an exception.
Put a validates_uniqueness_of :login_name on your User class, and
you'll get the behavior you want. You can keep the db constraint in
as a safety net aga
James Byrne wrote:
Q.
> To prevent duplicate values in the DBMS I use a unique index on those
> columns. I am testing that duplicate values cannot, in fact, be added.
> I thought, probably incorrectly, that when #save is called then any
> errors are returned to the controller to handle. This is
To prevent duplicate values in the DBMS I use a unique index on those
columns. I am testing that duplicate values cannot, in fact, be added.
This is the cucumber scenario:
Scenario: The legal name must be unique
Given I do have a user named "admin"
And the user named "admin" is authe
11 matches
Mail list logo