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

How to properly update active record in ruby

user553
1#
user553 Published in June 23, 2018, 4:21 am

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?

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO