On Friday, June 20, 2014 9:02:00 AM UTC-7, Nicolas Goy wrote: > > If I add a computed column and then call save, like so: > > u = User.select_append(Sequel.function(:now).as(:a_computed_column)).first > > And then call > > u.save > > I got > > PG::UndefinedColumn: ERROR: column "a_computed_column" of relation > "users" does not exist > > I know I can do > > u.save(:columns => User.columns) > > But is there a better way to manage such scenario? As I have tons of > computed columns. >
A before_update hook to remove entries from the values hash that are not in the model's columns should work. Note that this means the computed columns will no longer be available after saving, but I'm assuming that's probably a good thing, as changes to the row might affect the values of the computed columns. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
