similar to: update_attributes not working

Displaying 20 results from an estimated 10000 matches similar to: "update_attributes not working"

2006 Aug 08
1
form parameter
How can I change some parameters in a function of the controller. I have a User_Controller, who''s responsible for update the information fields in the database. The parameters are "id", "firstname" and "lastname". Now, I want to manipulate parameter "lastname", because I would like to add at the end a point. >> Thomas Miller
2006 Oct 05
2
update_attributes
I''m working on a form that updates a product record and several associated detail records. The detail records are showing and populating okay in the form. But when it hits the controller, I get Couldn''t find Detail with ID=detail AND (details.product_id = 38). The :detail params seem to refer to the correct record id. Anyone have an idea how to fix this? Here''s the
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 Dec 29
2
update_attributes fails: ReadOnlyRecord
I''m trying to update a record, but it just stops with "ActiveRecord::ReadOnlyRecord". I don''t understand why, because I never wanted my model to be read only. Relevant code: Controller: def edit @project = find_project if request.post? @project.update_attributes(params[:project]) if @project.save flash[:message] = _(''Project was
2008 Feb 11
3
can't update my data base using "update_attributes"
Hello, I have this problem that my rails application works fine in development environment on my local Linux and windows system but when I uploaded it to work on the server in production environment I have this problem as listed in the pasted log file at the end of this entry: NoMethodError (undefined method `[]'' for nil:NilClass): /app/controllers/admin_controller.rb:201:in
2009 Jul 01
2
Nested Forms - how to displayed the attributes content ?
I have a User model class User < ActiveRecord::Base has_one :account accepts_nested_attributes_for :account, :allow_destroy => true validates_associated :account attr_accessible :account_attributes is working fine, validating and updating both records (User and Account), but I caanot display the value in the form when is updated, ex: below the firstname is not displayed but
2008 Aug 31
6
why's my course_duration being reset
Can''t get this?...I''m close I think, my calculation appears to be working, but.... when i access duration = <%= @enquiry.course_duration %><br> in my final view it''s blank.. course_duration is getting set to null but works for the calculation? controller.. ---------- class EnquiriesController < ApplicationController layout ''welcome''
2010 Jun 23
0
Rails 3 - AJAX Response
Hi, I need help with some AJAX in rails 3. So basically, I have a select option in my index page for my User model. This select option is a form that modifies the user''s type. The " :remote => true " works and the type is changed when hit the submit button. But, nothing happens in the browser. The user is updated. I''m actually not sure where to put either my JS /
2006 May 19
2
update_attributes
My application is so far mostly built from scaffold. When I edit an existing record (I''ve turned off validation) the update method is called. I get this error: NoMethodError in <module>/<controller>#update You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.+ I get the same error when
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
2008 Jul 24
0
Errno::EBADF Send an Email in Rails using GMail
Hi, would someone please help me. I have been desperatley trying to fnd out for the last two days why the following code is not working. Any ideas. I''m running Instant Rails 1.4 / Rails version 1.2.5 / Ruby version 1.8.5 (i386-mswin32) / RubyGems version 1.1.1 / Action Mailer version 1.3.5 / Windows XP. Here is a description of my emailing application: in
2006 Apr 27
2
NoMethodError - why?
Getting this error when hitting update. NoMethodError in Article#update You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occured while evaluating nil.update_attributes Source code. def create @article = Article.new(params[:article]) @article.user = @session[''user''] if @article.save
2006 Apr 10
3
Problems with multiple ActiveRecords and Validations
Hi all, I am a RoR newbie and have the following scenario set up: There are 2 ActiveRecords involved, the first one being "User", the second one being "Visibility". The corresponding users table holds address informations regarding a User. The visibilities table holds visibility settings for the individual columns of the users table (i.e. firstname, lastname, country
2006 Jun 08
5
update only the join table in a HABTM - how?
I have a photographers app that requires giving access to galleries for users. in one part, I want to be able to define gallery access for a user seperate from updating any of the user info. I have this function: def edit_access @user = User.find(params[:id]) @user.galleries = Gallery.find(params[:gallery_ids]) if params[:gallery_ids] if @user.update_attributes(params[:user])
2008 Mar 03
15
update_attributes not updating
For some strange reason I can''t get update_attributes to work. Any reason why that might be? here is my code: controller: def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = ''Your Information was successfully updated.'' format.html { redirect_to(user_url(@user))
2006 Jan 17
2
update_attribute and validations
Just in case it saves someone else the several hours of insanity I just went through, update_attributes will not save unless the model validations are satisfied, but update_attribute (the singular form) will save the attribute to the database even if the model validations would fail! This appears to be a feature, not a bug (http://api.rubyonrails.com/classes/ActiveRecord/Base.html) although
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 Jul 12
1
Question re: Computing a field in a DB record
I''m just learning Rails and have encountered a problem trying to set a field in a DB record based on the value of another form input field. Using the scaffold code, the create works as expected and the update (edit) also works. However, one of the DB fields (amount) is supposed to be computer from another (units): if the category field is "Mileage", amount= units *
2009 Feb 03
1
update_attributes! does not update nested model
Hi! I have updated my app to rails 2.3. I have form that has few nested models and I am happy that I can just write accepts_nested_attributes_for :tasks, :allow_destroy => true, but update_attributes! does not update my nested model. I have tried update_attributes, and it works. Any ideas? Few lines from log: update_attributes: SQL (0.1ms) BEGIN Education Update (0.3ms) UPDATE
2006 Apr 18
4
how would you take the duplication out of this?
i have these two really similar methods in my addressbook controller. def edit_company @company = Company.find(params[:id]) if request.post? and @company.update_attributes(params[:company]) flash[:notice] = ''Company was successfully edited.'' redirect_to :action => ''show'', :id => @company end end def edit_person