On Thursday, May 31, 2018 at 1:36:00 AM UTC-7, Emil Ahlbäck wrote:
>
> It makes sense since there is of course no primary key. I don't understand 
> why the "naked" association (Employee.first.assigned_tasks) but not the 
> _dataset method. Is this something I can solve?
>

Try setting the primary key manually:

  Employee.set_primary_key :employee_record_id

Not sure off hand why it would be required for that association.  I could 
probably tell you if you provide the full backtrace so I can see what is 
calling Employee#pk.

Additionally if I understand a GitHub issue I read last night the right way 
> to make a "model" read-only is to override the save/update/delete methods. 
> I would be fine with that for now but is there perhaps another established 
> pattern to deal with materialized views like the one I have and "treating 
> them like read only models" (i.e. how does the community deal with this?)
>

Really, if you want the data to be read only, the best way to handle that 
is to enforce it in the database via database permissions (GRANT/REVOKE).  
Overriding Model#save/update/delete is only a partial fix.

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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to