Questions tagged [update-all]

36 questions
0
votes
1 answer

Rails 4 rake task to update records. Find by ts_code and update with CSV

bit of a messy one I'm having here trying to get this to work. I have a store with a database of products. What I have been given is a CSV file with 3 columns and over 500 entries, ts_code cost_price and sell_price. So I need a task that i can run…
shaneklive
  • 59
  • 7
0
votes
1 answer

Overriding update_all method for specific models Rails 4.2

I need to override the rails update_all method so that it will update updated_at field for specific models. I have added following module in app/config/intializer/xyzfile.rb : module ActiveRecord class Relation def…
Prajakta
  • 101
  • 1
  • 4
0
votes
3 answers

rails update_all interpolation

I have a database with a lot of pets. I am looking to update the 'name' attribute by changing it's case. I have tried: Pet.update_all(:name => Pet.name.upcase) Pet.update_all(:name => name.upcase) Pet.update_all(:name =>…
rikkitikkitumbo
  • 954
  • 3
  • 17
  • 38
0
votes
2 answers

Active Record specify a value select out from where() in update_all

I'd like to update multiple rows with update_all, but I need to use the existed value in one column selected from where(), how can I specify the value in update_all, it looks like this: # == Schema Information # # Table name: records # # id …
McGar
  • 205
  • 1
  • 10
0
votes
1 answer

Updating all the fields in a table using conditions in CakePhp

I have a table with some fields i want to update all the colums in a particular row, how we can do this? I want to update this array of data into the table $travel_details=array( 'userprofile_id'=>$upid, …
SibinF
  • 385
  • 1
  • 7
  • 25
-1
votes
2 answers

CAKEPHP 2.0 updateALL, json_encoded data

I have another problem with one of my controller functions. I have written a function that updates some fields from my database. I am grabbing the content from a decoded json_file and after I grabbed the data I have encoding it again so I could…
1 2
3