1

I'm just wondering how to implement database views in Ruby on Rails. Can you guys put some working example? And thank you for every advises and examples.

1 Answer 1

3

You mean client-side views on the database or views within the database?

Most relational databases support views which encapsulate a projection or other set-based operation into a virtual table:

CREATE VIEW viewname AS
SELECT *
       ,some_derived_column
FROM basetable
WHERE some_filter_criteria

Rails typically uses a pattern called Active Record to map database tables/views into Ruby for access at that layer. How you deal with it at that point is kind of wide open.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.