Displaying 20 results from an estimated 60000 matches similar to: "errors.add_to_base translation missing: en, activerecord"
2010 Apr 29
1
Setting a message on a model -without- errors.add_to_base
I''m trying my best to follow the skinny controller/fat model concept,
and I''ve got a series of callbacks (that I''m about to move into
observers) running on a few models. Based on what these callbacks do
to the data (it''s implementing business rules), I''d like to add some
type of message on the state of the model *without* invalidating it.
For example:
2006 Apr 07
2
errors.add_to_base
What are the limitations on using:
errors.add_to_base
to display errors in views?
I have tried for days to add errors from my object.rb and they never get
displayed.
class Keyword < ActiveRecord::Base
validates_presence_of(:name, :message => "Name is required.")
validates_uniqueness_of(:name, :message => "This name is already in
use. Please try
2011 Jun 15
1
.new_record? and :_destroy
Rails version 2.3.8
I have a ticket model that has many comments
the comments have an attribute called "admin" -- is this a comment
added by an administrator
the ticket has an attribute called "admin_email_address"
I want to validate when saving the ticket and say "if I have a new
admin comment, make sure I have an admin_email_address"
In my ticket model, the
2010 Apr 09
0
Child to Parent Validation Errors
Hi:
Passing child virtual attribute validation error to parent...
in case of nested attributes.
So, I have a Parent Model say ''Parent''.
Nested Attributes it accepts for Child say ''Child''
Now suppose there is a validate method in ''Child''
and it has something like self.errors.add_to_base("some message").
How do you make sure that
2010 Nov 18
7
Rails 3 ActiveRecord queries - I'm missing something very BIG
Hi,
I know I am missing something very big regarding the changes with
respect to activerecord in Rails 3.
I can''t find the explanation. And I''m sure someone will kick my ass for
not
finding the right piece of info in the docs and guides. Please do.
I have a working piece of code but I don''t like it.
So. Very basic association:
class Project < ActiveRecord::Base
2010 Apr 27
1
Translation Failure
Hi,
i''m getting a translation failure:
translation data {:username=>"Benutzername"} can not be used
with :count => 1
What does this means?
In my de.yml File i wrote in the activerecord part:
models:
user:
username: ''Benutzername''
Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby
2010 Mar 25
0
ActiveRecord::Base.transaction MySQL Lock Errors...
Hi there,
is there any known issues when using ActiveRecord::Base.transaction with
models who tables have constraints applied?
I have two models:
one (is associated with model two)
two (has MySQL foreign key and unique key constraints)
I''m doing something like this:
ActiveRecord::Base.transaction
one.create
two.create(reference to one)
one.create
two.create(reference to
2010 Aug 01
3
The {{key}} interpolation syntax in I18n messages is deprecated...
All,
Has anyone seen this - I am getting the following deprecation warning when
running my functional tests under rails 2.3.8 (just moved an app from 2.3.4
up to 2.3.8 in prep to move to Rails 3 --- if you think this problem is
solved in Rails 3 then let me know):
The {{key}} interpolation syntax in I18n messages is deprecated. Please use
%{key} instead.
I have isolated the problem to the
2010 Apr 26
2
woriking under webrick but not under passenger
Hi!
I have just added login feature to my rails application (followed the
instruction from (Agile Web Development with Rails) but now I am getting
strange errors (looks to me like some kind of routing problem) under the
passenger/apache.
The error is:
500 Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
From the log:
2011 Jul 26
1
ActiveRecord has_many associations
Given the models Country, State, City and Person as follows.
class Country < ActiveRecord::Base
has_many :states
end
class State < ActiveRecord::Base
belongs_to :country
has_many :cities
end
class City < ActiveRecord::Base
belongs_to :state
has_many :people
end
class Person < ActiveRecord::Base
belongs_to :city
end
Is there any way that doesn''t allow to delete
2011 Jul 19
2
ActiveRecord::Base.establish_connection in development and production envs
Hi, guys!
Background:
I''ve resque workers in my application. These workers do several jobs
that associated with DB. In development environment, I''ve no need to
provide some additional configuration for db, they are use development
database. But then I switching to production env, I set
ActiveRecord::Base.establish_connection with my production DB
parameters.
Problem:
When
2011 Sep 01
2
Custom ActiveRecord Error Message
I''m generating 3 models on 1 controller and i''m rescuing
ActiveRecord::RecordInvalid for validation errors, however 2 of the
models have the same attribute called "name", and if there''s an error on
that field, I wouldn''t know whether that belongs to model A or model B.
What then is the best way of modifying the error message of a validation
error
2011 Mar 25
4
how to solve ActiveRecord::ConnectionNotEstablished
*im using mysql as a database*
*
*
*im getting the error which says that *
ActiveRecord::ConnectionNotEstablished in GreetingsController#index
ActiveRecord::ConnectionNotEstablished
Rails.root: C:/railsdev/hello
Application Trace <http://localhost:3000/#> | Framework Trace<http://localhost:3000/#>
| Full Trace <http://localhost:3000/#>
2011 Jan 31
0
Rails 3 - Translation of Error header doen't work
I am preparing the upgrade of one RoR aplication that used Rails 2.3.8
and where all the translations worked fine. Now I discovered that it
is not the case any more. Everything seems to work fien except the
Error windows header where the interpolation is not recognized.
I''m using Rails 3.0.3, Ruby 1.9.2.
I''ve just created a simple application, downloaded the latest french
YML
2012 Nov 18
3
remarkable activerecord association RSpec
i''m using gem Remarkable activerecord for association. i''ve installed
remarkable and remarkable activerecrod both gem. i''ve added both gem in
my Gemfile. i''ve added "remarkable_activerecord" as required in
spec_helper.rb.
describe Authentication do
FactoryGirl.build(:authentication).should
belong_to(:user)
2010 Oct 27
4
Using ActiveRecord 3.0.x with Ruby 1.9.2
Can someone remind me of the incantation to use ActiveRecord in a
plain ruby program for the versions specified. I''m not having any luck
searching with google and I keep getting:
`require'': no such file to load -- activerecord (LoadError)
Not sure if this is a dependency or file path problem.
Thanks
--
You received this message because you are subscribed to the Google
2010 Jul 04
1
Rails 3: ActiveRecord .include not working
Really no idea what''s up...
class Auction < ActiveRecord::Base
has_and_belongs_to_many :categories
end
class Category < ActiveRecord::Base
has_and_belongs_to_many :auctions
default_scope order(''title'')
scope :active, where(:active => true)
end
class CategoriesController < ApplicationController
respond_to :html, :json
# GET /categories/:id
2010 Nov 18
2
Testing Error: ActiveRecord::StatementInvalid
I intentionally deleted the attribute author from the table comments.
When I used functional testing, I got the following message
ActiveRecord::StatementInvalid: PGError: ERROR: column "author" of
relation "comments" does not exist
What should I need to do in order to avoid this error message!!!
--
You received this message because you are subscribed to the Google Groups
2013 Feb 20
2
ActiveRecord callback chain exception?
I''m creating an ActiveRecord object A and want to update object B during
the process even if the creation of object A is rolled back due to a
before_create callback returning false.
Is there a way for me to do this?
It seems that once you''re in the ActiveRecord callback chain your DB
updates will be rolled back unless the entire callback chain returns
true.
Another way to look
2010 Jul 14
1
ActiveRecord::Observer, update_all and has_many
Hi,
I''m using an ActiveRecord::Observer to log users changing data in my
application. However, I''ve noted that adding an item to a has_many
relationship gets logged, but removing the item does not. That is:
@product.users << user
is logged, but:
@product.users.delete(user)
is not.
I''ve dug into ActiveRecord and found that the underlying issue is that
the