similar to: update_all broken in postgres?

Displaying 20 results from an estimated 800 matches similar to: "update_all broken in postgres?"

2008 Jul 02
3
update_all not changing updated_at
Hi everyone- Model.update_all works and changes the records, but it''s not changing the updated_at field. Am I doing something wrong or is this by design? Thanks, Dino --~--~---------~--~----~------------~-------~--~----~ 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
2006 Jul 06
4
update_all Not Incrementing lock_version
Shouldn''t update_all be updating lock_version? As you can see from my console session below, it is upating the record (changed running attribute to true and returned 1 to show 1 recored was updated). But it did not increment lock_version. And optimistic locking is working correctly otherwise. As you can see below, lock version = 562 before and after the update_all call but it is
2006 Jun 01
4
how can I control when to commit a transaction?
hello it seems like this question has appeared a few times with no answer: how do you get rails to issue ''write'' statements (ie ''CREATE/UPDATE'') to the database without committing each time? I tried setting ActiveRecord::Base.connection.begin_db_transaction before calling any action on my object, but as soon as myObject.save or myObject.update is called,
2006 Aug 10
6
save without commit ?
How do I get ''save'' to execute without commit? I have tried: ActiveRecord::Base.connection.begin_db_transaction # do some stuff that doesn''t issue a database COMMIT statement # then: @myObject.save # this issues a COMMIT but it shouldn''t! Shouldn''t it wait until I''ve called: ActiveRecord::Base.connection.commit_db_transaction ? what am
2007 Sep 07
6
ActiveRecord::Base#update_all expected behaviour
Hi I noticed that if in my code I use the following: Photo.update_all("title = ''Ruby rocks'' ", "id IN (#{@photo_ids})") All my objects are properly updated but none of the filters/callbacks are triggered. Is that what''s expected? I have a before_update filter set on the Photo class and it gets totally ignored, I guess the only way to solve this
2010 Jul 14
1
ActiveRecord::Observer, update_all and has_many
Hi, I''m using an ActiveRecord::Observer to log users changing data in my application. However, I''ve noted that adding an item to a has_many relationship gets logged, but removing the item does not. That is: @product.users << user is logged, but: @product.users.delete(user) is not. I''ve dug into ActiveRecord and found that the underlying issue is that the
2007 Jul 12
0
update_all for an AR instance
Is there anyway to call "update_attributes" where it updates only the attributes you specify with the update command. The only thing close to this is update_all where you have to specify the condition. So essentially you''d be stuck doing "id=#{obj.id}" as the condition. Are there any built in AR functions that allow you to update a particular object using straight
2005 Nov 30
0
Passing variables with update_all
I''d like to produce an SQL update along the lines of: UPDATE companies SET category2={newcategory} WHERE (category2 = {oldcategory}) At the moment I''ve got: ctype = params[:ctype] Company.update_all("category2=ctype", "category2=ctype") At present this returns a StatementInvalid: Unknown column ''ctype'' in ''where clause'':
2006 Jun 09
8
[how can i delete a file system..please help]
Hi, I''m trying to delete a file system (<xml_26548975.xml>) File.delete("xml_26548975.xml") But I get this error: "Permission denied - ./script/../config/../uploads/xml_26548975.xml". Why? -- Cheers, ioana k&a http://boulangerie.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL:
2007 Oct 12
2
missing attribute: reorder
I am trying to use an integer object as a flag item for displaying a link on a page called reorder that is a column in my PlanProcedures table. I''m getting an error that says The Header is NoMethodError in Manage_plan_procedures#list missing attribute: reorder Here is what my model looks like: >> PlanProcedure.column_names => ["id", "plan_id",
2006 Jun 08
3
Back again; errors in depot app
Sorry, but this is a big one - after adding the Ajax portion of the Agile Web Development tutorial my page displays: Application error Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html It started when I added - page[:current_item].visual_effect :highlight, :startcolor => "#88ff88" , :endcolor =>
2006 Jan 23
4
ActionRecord: how to update many records in one statement
Hello, I am trying to edit and update all records of table ?intersts? (id, name, description) on one page and has no good idea how to do it right, when updating one record per page it?s ok The question is: what statement instead Interest.update_all(params[:interest]) in controller need to use to successfully update the database table by data passing to controller in parameter ?interest??
2007 Sep 21
1
Temporary disabling after_update
Hi, I am trying to replace my old database trigger with ActiveRecord callbacks in rails. I have a model like following: class Action < ActiveRecord::Base belongs_to :inquiry def after_update #clean up all action associated with the inquiry. Action.update_all("latest = ''''", ["inquiry_id = ?", self.inquiry_id]) #find the latest action
2006 Jun 01
7
Active Record Basics - Making it commentable
hi everyone, I hope someone can help me out with some active record basics? I''ve been banging my head for the past 4 hours and I can''t seem to get it to work. I am trying to add comments to a caption (just like how one adds a comment to a post in a blog). I seem to be able to read posts just fine from the DB, however, I can''t use the "recordComment"
2006 Jun 04
3
Data manipulation from a database
Say, for example, I have this in my db: id name date 1 Item_1 feb-19 2 Item_2 feb-20 and I want to manipulate it so that the view can output this: feb-19: Item1 feb-20: -- Posted via http://www.ruby-forum.com/.
2006 Jun 01
4
can''t convert Fixnum into String ??
I have been getting this error message on various pages, just wondering if anyone could explain whats going wrong, and the best way to correct it code that is cuasing the problem is below @project = Project.find(:first, :conditions => "id = " + @purchaseorder.project_id) -- Posted via http://www.ruby-forum.com/.
2006 Jun 01
8
[Pdf::Witer]
Is anyone using Pdf::Writer? I don know how to insert html tags in a pdf using Pdf::Writer, except <b> and <i> I think an idea is with Pdf::TechBook but i hadn''t seen any example till now. -- Cheers, ioana k&a http://boulangerie.wordpress.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Jul 04
4
ROaR: A Ruby on Rails Podcast
I''m starting a new podcast to cover some of the hot topics going on in Rails. Half news, half interactive, all community. As always, the first episode kinda sucks but I''m looking forward to feedback from all of you on how to make it better. http://www.simiancodex.com/roar/ or for iTunes people http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=163609703 Michael
2006 Apr 11
6
Reduce Number of Queries When Using ActiveRecord
I have a controller method called update_all that grabs parameters for about 30 form fields and saves them to the database. My current code looks to see if there is a string in params[] for each form field (two fields for each SelfEvaluationItem) and saves the updated self_evaluation_answer if a string is available. Since this is iterated code, I am almost certain that this generates 30 or so
2006 Jun 08
5
Field names in validators
Hi! Is there a (simple) way to use alternative field names in validation messages? For example, if I have a validator like this one: validates_presence_of :email how can I make it print a message like "E-Mail Address can''t be blank" instead of "Email can''t be blank"? I can override the "can''t be blank" part by using the :message