similar to: How to update partial attributes of a object from a form?

Displaying 20 results from an estimated 3000 matches similar to: "How to update partial attributes of a object from a form?"

2006 Jun 01
9
@model.errors.empty? => true; @model.valid? => false
Hi, So, how can the situation described in the subject come to be? In other words, what could be invalidating the model, yet not generating an error? thanks, jh ps. here''s the breakpoint session paste: irb(#<#<Class:0xb72eec00>:0xb72eeb10>):003:0> @project.errors.empty? => true irb(#<#<Class:0xb72eec00>:0xb72eeb10>):004:0> @project.valid? => false
2006 Apr 03
4
How to fake composite primary keys?
I know ActiveRecord doesn''t support composite primary keys, but I need to use one, and I need it ASAP. I don''t need any composite foreign keys, luckily; what I have is a table that stores old versions of rows in another table, so the composite key is an id + date stamp. Would someone tell me a hack I can use to support this? -- View this message in context:
2006 Jun 23
3
form_remote_tag is not passing form params
I''ve searched and searched and searched again, and I cannot find any help with this problem. There''s an identical problem on this forum, but it was never resolved. I''ll try to re-open the subject with a bit more information. Problem: The form_remote_tag() method in my "list" view is not passing the params[] hash of the values stored within my form.
2006 Jan 08
3
Family Connection 1.1.2
== What is Family Connection? == Family Connection is an easy-to-setup online hub for your family that includes a Family News section with Photos, and an Address Book. For more information, visit http://familyconnect.rubyforge.org/ == Downloads == Latest: svn checkout svn://rubyforge.org/var/svn/familyconnect/trunk Version 1.1.2: svn checkout
2006 Jul 05
2
RJS - Getting and Setting Form Element Values Question
I''m still a beginner with RJS so forgive me if this is a simple one - but certainly it doesn''t seem logical and googling has not led to . Given a field with an id of ''posting_subject'' I can do the following in my controller with RJS. render :update do | page | subject = ''this is really something
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 Mar 29
5
How to skip password validation when updating other fields?
Besides the hashed password, which is saved to db, I have two password-attributes in my User model: attr_accessor :password, :password_confirmation I have validations on these attributes, and I need them to work both on create and update, since I have pages for changing and resetting the password. Now when I want to update just the user''s login name, I guess I have the next
2007 Apr 23
3
How to change Date format
Hi all, I am using InstantRails with MySQL-Front. Date is stored in format yyyy-mm-dd in database. I want to retrieve and show date in dd-mm-yyyy in my view.rhtml. How can I change it to dd-mm-yyyy form. Please help me out. Thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google
2006 Feb 27
4
update_attribute with Validation?
Does anyone know of a way to update individual attributes with validation? update_attribute disables the validation checks in the record model, so I''m wondering if there''s a workaround for this. In my application, I want to allow the user to update some or all the attributes without having to enter :password and :password_confirmation, both of which are subject to
2009 Jun 22
4
modal validation not works
Hi everyone, i have 20 fields in users table. in my admin profile module the admin can modify his infomation. but only 12 fields he can able to modify. so in my controller if params[ :profileinfo ][:first_name] @profileinfo.update_attribute(:first_name,params[ :profileinfo ][:first_name]) end the above simply saves what i enter into the field.why it doesnot consider the modelvalidation.
2006 May 02
9
Updating only one field
At present, I use an update like this to set the user''s last login time: authenticated_user.update_attribute(:last_login, Time.now) However, this calls the following, updating all fields: UPDATE users SET `last_login` = ''2006-05-02 13:27:41'', `hashed_password` = .... Is there any way I can tell ActionRecord to only update the one field? I don''t really want
2006 Jun 21
5
model with not te be updated attributes ?
Hi List, I have a table that contains several fields that must be initialized when first created, but may not be altered afterwards (when updating the other fields) because they can be changed by external processes. I noticed that the ActiveRecord update commands (even update_attribute) only seem to work by loading the complete record, changing fields that need to be changed and doing a full
2006 Apr 14
2
spot the error (I can''t, I''m new)
I have a form that I want to use to update multiple objects. In the controller, @grades = Grade.find(params[:grade].keys) @grades.each_with_index do |grade, i| grade.update_attribute(params[:grade][i]) end all_valid = @grades.inject(true) {|memo, c| c.valid? && memo } this doesn''t update the attributes as I would expect. (I would just use
2006 Jun 14
3
Attributes for a model which are excluded from DB?
If I want to do this but not save to the database, how can I go about it? things.each do |thing| changed = someotherqueryresult thing.update_attribute :testattrib, changed end Essentially I want to create a collection called things with some extra attributes that are not saved into the database, as they are just used for sorting in a view and should not be saved (in fact saving them wastes
2007 May 21
7
How do I stop a column being updated by model.save?
One of my models has a column that is updated very frequently from a separate process, so it is important that when a record is saved in rails, this column should be left alone. In the update method of the controller I have: @record = MyModel.find(params[:id]) @record.update_attributes(params[:my_model]) params[:my_model] doesn''t have a reference to the column I''m talking
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])
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 =
2006 May 17
10
HABTM << producing incorrect insert sql ?
Greetings railsers - I''m trying to add to a collection through HABTM, but the sql insert is trying to insert a PK rather than letting mysql produce the auto_increment''ed PK. ## @medication_dose holds a validated, saved model @medication_dose.medication_frequencies << MedicationFrequency.find (:all) The above bails with, Mysql::Error: #23000Duplicate
2006 Jul 17
19
updating model
hello, i am writing a simple user login system. when registering a user account, i have two field: password password_confirmation which are validated using validates_presence_of validates_confirmation_of and these are then used to generate a password hash which is stored in my database when i want to update the record (without changing the password and entering new values for password and
2013 Dec 02
2
creating opus encoder and decoder executable on Windows
Hi all: How do I create opus encoder and decoder executable on Windows using MS Visual Studio 2010? What I'm doing is the following: 1. I downloaded the codebase on my local drive using: $ git clone git://git.opus-codec.org/opus.git 2. Then I go to D:\opus\win32\VS2010 and open the opus.sln using MS Visual Studio 2010. 3. Then I build the solution opus. I get 3 executable at