sql - basic modification of default model output with scope -


I do the same thing again and again to make a small modification for standard model output I am I have a series of tables that I store information about products, and the prices of all stores are deposited in US Dollars, but the output depends on the currency that the user wants their session Get accumulated in

Example:

  Product Expansion Blah Price Hummer Red More 5.00 Nail Blue Stuff 3.99  

What is a simple to modify output The way is, when I call:

  Product.all  

I like something

  Product.all .currency ('EUR') Product.find (22) .currency ('EUR') Product.find (: ('EUR')  

or

< Pre> Product.all.currency (0.69) / code>

And just multiply all the items in the price column? Can this name be named?

Try to rearrange your chaining:

  Product.currency (0.69) .all  

I have not tested this, but your < Code>: Select in * There may be a problem with other criteria


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

kernel - How to create a "Block device" in Windows -