search for: new_record_before_save

Displaying 20 results from an estimated 22 matches for "new_record_before_save".

2007 Nov 14
1
has_many_polymorphs and acts_as_list ?
...t; created_at: 2007-11-14 13:19:06 elements: - &id003 !ruby/object:Page attributes: name: P1 updated_at: &id002 2007-11-14 13:18:39.397292 +01:00 id: 1 created_at: *id002 errors: !ruby/object:ActiveRecord::Errors base: *id003 errors: {} new_record: false new_record_before_save: true - &id005 !ruby/object:Page attributes: name: P2 updated_at: &id004 2007-11-14 13:19:06.052972 +01:00 id: 2 created_at: *id004 errors: !ruby/object:ActiveRecord::Errors base: *id005 errors: {} new_record: false new_record_before_save: true errors: !ruby...
2006 May 17
0
acts_as_versioned with lock_version bug?
...0218s == CreateTables: migrated (0.0589s) =========================================== # ++++ Using the versioned data ++++ % ./script/console Loading development environment. >> s = Software.create :name => "Initial name" => #<Software:0xb7b3c290 @new_record_before_save=true, @errors=#<ActiveRecord::Errors:0xb7ae3ff0 @errors={}, @base=#<Software:0xb7b3c290 ...>>, @attributes={"name"=>"Initial name", "id"=>1, "version"=>1}, @new_record=false, @changed_attributes=[]> >> s.version =>...
2006 Mar 24
6
Should counter_cache fields be saved in the database?
...hild in the console and verify the number of children. When I quit and restart the console, however, the children_size column is 0. [flashbang:...WebContent/rails/development/test] ryann% ./script/console Loading development environment. >> parent = Parent.create => #<Parent:0x2385f24 @new_record_before_save=false, @new_record=false, @errors=#<ActiveRecord::Errors:0x2351dc8 @errors={}, @base=#<Parent:0x2385f24 ...>>, @attributes={"name"=>nil, "id"=>1, "children_count"=>0}> >> parent.children.create => #<Child:0x234d070 @new_record=false,...
2007 Oct 22
1
self-referential habtm: why are my keys null?
...s={"name"=>"child"}>] >> p.children => [#<Node:0xb714a8f4 @new_record=true, @attributes={"name"=>"child"}>] >> c.parents => [] >> p.save => true >> c.save => true >> p.reload => #<Node:0xb7192348 @new_record_before_save=true, @children=nil, @new_record=false, @attributes={"name"=>"parent", "id"=>"1"}, @parents=nil, @errors=#<ActiveRecord::Errors:0xb71251a8 @errors={}, @base=#<Node:0xb7192348 ...>>> >> p.children => [] >> c.reload => #&l...
2007 May 11
2
spec a replace_html with a partial
I wanted to use ARTS to add RJS in a behaviour driven way to my application, but I''m having some trouble asserting a replace_html with a partial. I''ve created a pastie (http://pastie.caboo.se/60694) which contains the RJS I want to spec, the spec which I already wrote and its failure message. I''m currently using RSpec-0.9.2
2006 Jun 07
1
Setter that converts a float attribute to integer
...all is working fine: $ script/console Loading development environment. >> r = Report.new => #<Report:0xb74a53c0 @new_record=true, @attributes={"precio"=>nil}> >> r.price_in_euros = 2.45 => 2.45 >> r.save => true >> r => #<Report:0xb74a53c0 @new_record_before_save=true, @new_record=false, @errors=#<ActiveRecord::Errors:0xb7813264 @errors={}, @base=#<Report:0xb74a53c0 ...>>, @attributes={"id"=>20, "price"=>245}> The attribute "price" has been set to 245 cents. Ok, let''s check the database: mysql&g...
2006 Jun 07
2
Problem with a setter that converts euros to cents
...all is working fine: $ script/console Loading development environment. >> r = Report.new => #<Report:0xb74a53c0 @new_record=true, @attributes={"precio"=>nil}> >> r.price_in_euros = 2.45 => 2.45 >> r.save => true >> r => #<Report:0xb74a53c0 @new_record_before_save=true, @new_record=false, @errors=#<ActiveRecord::Errors:0xb7813264 @errors={}, @base=#<Report:0xb74a53c0 ...>>, @attributes={"id"=>20, "price"=>245}> The attribute "price" has been set to 245 cents. Ok, let''s check the database: mysql&g...
2006 Aug 09
0
admin.create error in devel. console
...;1", "add_xxxxxx"=>"1", "purchase_info"=>"1", "add_admins"=>"1"}, :agreement => "1" => #<Admin:0xb79488f4 @errors=#<ActiveRecord::Errors:0xb79386d4 @base=#<Admin:0xb79488f4 ...>, @errors={}>, @new_record_before_save=true, @attributes={"capabilities"=>{"member_info"=>"1", "close_xxxxxx"=>"1", "purchase_info"=>"1", "add_xxxxxx"=>"1", "add_admins"=>"1"}, "salt"=>"&quo...
2006 Jun 03
1
Can I tell if the associated record is new in a belongs_to save?
In a belongs_to association, is there a way to tell if the associated object was newly created? Hopefully this will explain my question: A Firm class declares has_many<http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000530>:clients and a client class declares
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
...lub", "updated_by"=>nil, "id"=>"7", "description"=>"", "deleted_by"=>nil, "created_at"=>nil}> >> sc.destroy => #<SportClub:0xb769c1a4 @sportables_sports=[], @deleted_by=nil, @contact_address=, @new_record_before_save=nil, @events=[], @attributes={"number_of_members"=>nil, "name"=>"Maastricht Wildcats", "updated_at"=>"2007-08-03 21:50:44", "deleted_at"=>nil, "created_by"=>nil, "organization_code"=>"KNVB347&quot...
2006 Feb 16
1
validations with associated object
Does anyone know if Rails is supposed to validate associated objects on creation? Say you have a User model, with has_many posts, and a Post model which belongs_to user. Further, the Post model has a validates_uniqueness_of :title. u = User.find(1) # this should pass u.posts.create :title => ''my new post title'' # this should fail u.posts.create :title => ''my
2006 Mar 25
0
Self-Referential Many-To-Many relationships where the relationship itself has data.
...oblems: >> friends = user.all_friends >> f = friends[0] => #<User:0x257f358 @attributes={"rating"=>"1", "id"=>"2", "user_id"=>"2", "name"=>"bob", "friend_id"=>"4"}, @new_record_before_save=nil, @errors=#<ActiveRecord::Errors:0x2579ee4 @errors={}, @base=#<User:0x257f358 ...>>> >> f.rating = 2 => 2 >> f.save ActiveRecord::StatementInvalid: Mysql::Error: Duplicate entry ''bob'' for key 2: UPDATE users SET `name` = ''bob'' WHE...
2006 Jan 10
8
Noob: Child records not saved
Hi all, happily coding along, but it seems a belongs_to record is not saved. # Create some stuff def create_project @contact = Contact.new @project = Project.new(@params[''project'']) @project_contact = ProjectContact.new(@params[''collect'']) @project.project_contact = @project_contact contact =
2006 Oct 16
3
Saving many_to_many
Ahoy, i''m trying to save a many to many between "talent" and "vital stat" talent_controller.rb def edit @talent = Talent.find(params[:id], :include => [:talent_type, :vital_stats]) @talent_types = TalentType.find_all @vital_stats = VitalStat.find_all if request.post? @talent.attributes = params[:talent] @talent.attributes =
2007 Feb 04
2
Per activerecord object callbacks (aka: should I have gone to bed hours ago?)
...''s my super hacked "proof of concept" (if it can even be called that). http://pastie.caboo.se/37802 and a little extract from the console demonstrating it. >> t = Taggable.create => #<Taggable:0x1462de0 @attributes={"name"=>nil, "id"=>1}, @new_record_before_save=true, @errors=#<ActiveRecord::Errors:0x2810d2c @base=#<Taggable:0x1462de0 ...>, @errors={}>, @callbacks={}, @new_record=false> >> tag = t.tags.create => #<Tag:0x27d5b50 @attributes={"name"=>nil}, @errors=#<ActiveRecord::Errors:0x27bd5f0 @base=#<Tag:0x2...
2005 Dec 23
6
Save using Update
Hi, I want to update an existing row in table "items" where items.id == 10 I tried this: item = Item.new item.f1 = ... item.f2 = ... ... item.id = 10 item.save I got an error Duplicate entry ... for key 10 : INSERT INTO items ... How do I make item.save to use UPDATE instead of INSERT? -- Posted via http://www.ruby-forum.com/.
2006 Apr 04
2
HABTM
...deleted: "0" verified: "1" login: tbender salted_password: 393e2195368915812e1490528ae3071b2f266e6f email: tbender@cl.uni-heidelberg.de errors: !ruby/object:ActiveRecord::Errors base: *id001 errors: {} items: [] new_password: false new_record_before_save: return-to: flash: !map:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=3D>[], "Cache-Control"=3D>"no-cache"}
2006 Oct 13
3
Validation errors in has_one/belongs_to relationships.
I have two objects, QuoteInput and Insured. QuoteInput has one Insured and Insured belongs to QuoteInput. I don''t understand what I''m seeing. I assign an Insured to a QuoteInput. The Insured object has invalid data. I call save! on the quote input. QuoteInput has no validations. I expect two things to happen - 1) an exception should be thrown, indicating that there was a
2006 Apr 10
0
TaskThis undefined method `remembrall_expires'' for #<User:0x
...e: true show_addtask: false show_completed: false show_notes: false password: 68e02f78cad0acd054c06c84eebd80e1a7b0eb0d login: admin remembrall_expired: email: fabio@sferaconsulting.it errors: !ruby/object:ActiveRecord::Errors base: *id001 errors: {} new_record_before_save: :user_prefs: animate: true show_addtask: false show_notes: false show_completed: false flash: !ruby/hash:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} -- Posted via http://www.ruby-forum.com/.
2006 Feb 12
7
ROR Recipes Beta: Why use taggings instead of tags_contacts? NoMethodError tag_with?
...', :title=>''Home Pages title'', :desc=>''My note about this favorite'', :created_at=>Time.now) => #<Favorite:0xb6f5d594 @new_record=false, @errors=#<ActiveRecord::Errors:0xb6f54bb0 @base=#<Favorite:0xb6f5d594 ...>, @errors={}>, @new_record_before_save=false, @attributes={"updated_at"=>Sun Feb 12 15:30:38 CST 2006, "title"=>"Home Pages title", "portal_id"=>0, "member_id"=>0, "id"=>12, "url"=>"http://home.com", "desc"=>"My note ab...