similar to: update_attributes! does not update nested model

Displaying 20 results from an estimated 100 matches similar to: "update_attributes! does not update nested model"

2011 May 19
1
update_attributes updates data from second instance of nested form but not the first
Got a weird situation with an update put to a controller with a form with nested attributes. On the data below, I am updating data for both items (''0'' and ''1'') in rosters_attributes (in the example below I am updating the ''name'' attribute to a new value in both cases. What I am stuck on is that ''1'' gets its data updated,
2012 Aug 17
3
Rails doesn't validate create_model or build_model (has_one association)
I''ve got User has_one Shop. Rails is not validating when I tried create_shop or build_shop, neither in the browser nor the rails console. My code: class Shop < ActiveRecord::Base attr_protected :user_id belongs_to :user validates_presence_of :name, :primary_address, :city, :country_code, :currency end class ShopsController < ApplicationController before_filter
2012 Sep 16
1
“Routing Error No route matches {}” when omniauth failed on registration
(Original question was asked here: http://stackoverflow.com/questions/11506734/routing-error-no-route-matches-when-omniauth-failed-on-registration ) I am using omniauth-identity and configure its "fail on registration". My files: config/initializers/omniauth.rb OmniAuth.config.logger = Rails.logger Rails.application.config.middleware.use OmniAuth::Builder do #... provider
2011 Aug 14
5
Puzzled with form on multiple table rows
I''ve got a table of events, and each event has a boolean attribute is_ten_event. On each row of the table is a chekbox to edit the value of is_ten_event, so that multiple rows can be edited with one submit. In order to allow boxes to be un-checked as well, the logic in the controller works like this get array of events from checkboxes that are ticked. make all events.is_ten_event =
2011 Jul 25
5
Arel quiz: complex queries with associations
I have a real-world application with some complex queries that I want to convert to Arel (as part of an upgrade to Rails 3.1). So that I can understand what I''m doing before I flail around in my real app, I wrote a little sample app (just the models) with some similar associations -- one table joined with itself and more tables that join to another table, so there are some queries that
2011 May 08
1
Transaction - but no rollback?
Hello, I''m having trouble with transactions with rails 3.0.3 and mysql 5. I''d like to import data etl-batch-style: class Job < ActiveRecord::Base # ... def perform_etl connection.transaction do extract # some connection.execute / job.update_attribute stuff transform # some connection.execute / job.update_attribute stuff end end #... end
2020 Jul 16
2
[PATCH 0/7] *** IRQ offloading for vDPA ***
On 2020/7/16 ??12:13, Zhu, Lingshan wrote: > > > On 7/16/2020 12:02 PM, Jason Wang wrote: >> >> On 2020/7/16 ??11:59, Zhu, Lingshan wrote: >>> >>> On 7/16/2020 10:59 AM, Jason Wang wrote: >>>> >>>> On 2020/7/16 ??9:39, Zhu, Lingshan wrote: >>>>> >>>>> >>>>> On 7/15/2020 9:43 PM, Jason Wang
2020 Jul 16
2
[PATCH 0/7] *** IRQ offloading for vDPA ***
On 2020/7/16 ??12:13, Zhu, Lingshan wrote: > > > On 7/16/2020 12:02 PM, Jason Wang wrote: >> >> On 2020/7/16 ??11:59, Zhu, Lingshan wrote: >>> >>> On 7/16/2020 10:59 AM, Jason Wang wrote: >>>> >>>> On 2020/7/16 ??9:39, Zhu, Lingshan wrote: >>>>> >>>>> >>>>> On 7/15/2020 9:43 PM, Jason Wang
2006 Jan 04
0
update_attribute works, update_attributes doesn''t, why?
Hello again... so I narrowed my problem down. For some reason, while using login_generator, any User object I pull from the DB can be updated one attribute at a time using update_attribute, but when I try and do update_attributes it fails every time. Is this a limitation with login_generator that I don''t know about, or is there a way around this? I also tried the .update method and
2006 Jul 11
3
update_attributes and save!
I notice that ActiveRecord::Base.update_attributes() calls save(). What if I want to get an exception if the save fails? Is there a way to get the update_attributes() function plus the save! function? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
2006 Jun 26
0
Update_attributes working, or not? I can''t tell.
I have a basic login system implemented. I''ve recently added a timestamp field "last_activity_time". During the login process, if I successfully get back a user object, I do this: user.update_attribute(:last_activity_time, Time.now()) It appears to be successful given the breadcrumbs I''ve strewn around it, but nothing gets written out to my table. In
2006 Jun 27
1
user.save now workie, but user.update_attributes does
In my User model, I had this: def update_last_login_time self.last_login = Time.now self.save end But last_login was not being set. When I changed it to this it worked: self.update_attribute( :last_login, Time.now ) Any ideas why? ~S
2006 Apr 21
0
collection_select has_and_belongs_to_many update_attributes
I know there have been threads on this before but I was thinking shouldn''t multiple collection_select automatically update habtm relations when you update_attributes? In order to get multiple collection_select to work I use: collection_select(:user, :group_ids, Group.find(:all), :id, :name,{},{:multiple=>'''',:name=>''group[id][]''}) In fact if I
2006 Apr 28
1
@model.update_attributes(params[:model]) without saving?
Is it possible to update the parameters from a form without saving? @model.update_attributes(params[:model]) will save the model after updating its attributes. I''d just like the attributes updating without a save. Thanks Chris -- Posted via http://www.ruby-forum.com/.
2008 Jan 21
1
specin'' update_attributes! + Hash
Hi, I am facing a problem while trying to test a method that updates an attribute. The attribute format should be converted to YAML format before storing in the table which is excatly what is going on. But when testing it using expectations in rspec it returns an error. *** below is the error message : Spec::Mocks::MockExpectationError in ''InteractController (submit) - saving a form to
2006 Feb 04
0
object.update_attributes(hash)
shouldn''t @m.update_attributes(params[:m]) only update the attributes listed in the params hash? it tries to update all table attributes I hacked _form.rhtml and removed some of the fields, hoping that they will not be updated.. but it didn''t work.
2006 Jan 15
0
update_attributes not working
I dont know if its me or the dodgy win-32 intall of ruby/mysql, but I can''t seem to get update_attributes to work. In my user controller, I have: def update @user = User.find(@params[''user'']["id"]) if @user.update_attributes(@params["user"]) flash["success"] = "Updated Successfully" redirect_to :action =>
2007 Mar 25
1
Optimistic locking and update_attributes: not working?
Hi all, I''ve searched the forumns, but I can''t seem to find an answer to this one. I''m having trouble getting optimistic locking (OL) to work in my app, even though all of the pieces are there: * table has lock_version column, with default of 0 (zero) * lock_version column is being incremented by the first update (but the second doesn''t catch it) *
2008 Aug 26
1
transaction not working with update_attributes!
I am trying to wrap the updating of two models in a transaction and when the transaction fails it is not rolling back. My method is : def update_attributes(user,params) @user = user @company = user.company begin User.transaction do @user.update_attributes!(params[:user]) @company.update_attributes!(params[:company]) end true rescue false
2011 Jun 06
0
quick question: are errors best checked on controllers by stubbing save/update_attributes?
Hi, Is it best to simulate errors in functional testing by stubbing the controller save/update_attributes to return false? Will I miss anything important if I always test controller behavior in the case of errors in this way? Thanks, Lille -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to