hi i’ve got one action which i want it to perform a sql update query.
how can i just run a sql query within my rails app?
e.g.
def
@sql = “update … from mytable”
execute @sql
redirect_to :action => ‘list’
end
any ideas?
hi i’ve got one action which i want it to perform a sql update query.
how can i just run a sql query within my rails app?
e.g.
def
@sql = “update … from mytable”
execute @sql
redirect_to :action => ‘list’
end
any ideas?
don’t worry, worked it out…
http://softiesonrails.com/2007/7/23/performing-a-sql-update-in-rails
Image.update_all ‘inform_police = true’, ‘user = joker’
John.
On Dec 13, 2007, at 11:17 AM, John G. wrote:
redirect_to :action => ‘list’
endany ideas?
I’ve done it two ways:
and
Not sure which way is considered more proper, though.
Peace,
Phillip
nice, i’ll have a look at that, thanks.
John.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs