Home How to properly update active record in ruby
Reply: 0

How to properly update active record in ruby

user3655
1#
user3655 Published in September 20, 2018, 12:45 pm

I have model having update method as

def udpate_something(params)
    update(id: params[:id],
           b: params[:b],
           c: params[:c],
           d: params[:d])
end

and in controller

def update
    Model.find(id: params[:id])
         .update_something(id: params[:id]
                           b: params[:b],
                           c: params[:c],
                           d: params[:d])
end

Is this the right way to update or there is a better way?

share|improve this question

1 Answer 1

active oldest votes
up vote 0 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.350166 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO