where to define a rails view table and instead a mysql table is created -


i using ror3.2 , have bunch of model objects now. 1 thing i'd have mysql view i'm not sure put it.

class createqv < activerecord::migration   def      execute <<-sql       drop view qv     sql      execute <<-sql2 #abbreviated view  create view qv select locations.name val locations (locations.is_enabled = 1) union select concat(menu_items.header,' ',menu_items.detail) val menu_items (menu_items.is_enabled = 1)     sql2   end end 

and update via

rake db:reset 

but creates table , i'm not sure why. proper way of creating view? if yes, why table created?

thx

afaik that's right behavior view, create pseudo table, gets updated every time update associated tables. question me is: why create view rails app? reason create view i'm aware of, deny users full access data. in rails app, control show whom , can change.

i might wrong though i'm not familiar relational databases.

edit: can test whether view works creating new location , looking in view


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -