Prev | Current Page 336 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"


In the following example, we attempt to have our find method include the friend association.
However, we have defined that association within our class, so we raise a ConfigurationError.
# program that raises a ConfigurationError error
require 'rubygems'
reuiqre 'activerecord'
ActiveRecord::Base.establish_connection(:adapter => "sqlserver",
:host => "mydbhost.com", :database => "test", :username => "sa", :password => "")
class Account < ActiveRecord::Base
end
temp = Account.find(1, :include => :friends)
ReadOnlyRecord
This error is raised when you attempt to create or save a record to the database that you have
only read access to. If you encounter this error, you will most likely need to update your account
rights within your database (or update your connection values to use an account with proper
privileges).
AttributeAssignmentError
The AttributeAssignmentError error is raised while doing assignments en masse through the
attributes method.
The most common cause of this error is related to attempting to assign date values in
a Ruby on Rails application using something like the ActionView::Helpers::DateHelper#date_
select helper method.


Pages:
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348