On Fri, 2009-11-06 at 03:11 +0100, Marnen Laibow-Koser wrote:
> bill walton wrote:
> > Hi,
> > 
> > On Thu, 2009-11-05 at 17:55 -0800, Zovar wrote:
> >> Hello,
> >> 
> >> I was wondering if there is a right way to keep some 
> >> static arrays of data inside the application.
> > 
> > I'd consider storing them in the models to which they relate.  If they
> > need their own models, that's easy too.  The models don't have to
> > inherit from ActiveRecord.
> 
> I'm about to try something kind of similar.  I'm going to be 
> experimenting with storing state and country info outside the DB, since 
> it's static and relatively small.  I hope to use one of the tableless AR 
> libraries to make the data act like an AR model, though.  Perhaps I'll 
> find out why no one does this... :)
----
I wouldn't say that no one does this... and note to the OP, I use
app/helpers/application_helper.rb so these constants are available
anywhere in the appliction

$ cat /app/helpers/application_helper.rb 
# Methods added to this helper will be available to all templates in the
application.
module
ApplicationHelper                                                             

  # Select List of Yes / No
  YES_NO = [
    [ "Yes", true ],
    [ "No",  false ]
  ].freeze unless defined? YES_NO

  # acl
  SECURITY_LEVEL = {
     "payables_write_checks" => 14,
     "payables_accept_checks" => 14,
     "payables_print_checks" => 14,
     "payables_print_the_checks" => 14,
     "reports_inventory_reports_view" => 3,
     "reports_price_list_w_costs" => 5,
     "reports_price_list_w_costs_export" => 5,
     "reports_price_list_wo_costs" => 4,
     "reports_price_list_wo_costs_export" => 4,
     "reports_payable_reports_view" => 6,
     "reports_commissions_print" => 8,
     "reports_commissions_export" => 8,
     "reports_tax_reports_view" => 12,
     "reports_state_taxes_print" => 8,
     "reports_state_taxes_export" => 8,
     "reports_sco_taxes_print" => 8,
     "reports_mes_taxes_print" => 8,
     "reports_phx_taxes_print" => 8,
     "reports_peo_taxes_print" => 8,
     "reports_sco_taxes_export" => 8,
     "reports_mes_taxes_export" => 8,
     "reports_phx_taxes_export" => 8,
     "reports_peo_taxes_export" => 8,
     "reports_receivable_reports_view" => 8,
     "reports_customers_all_print" => 8,
     "reports_customers_all_export" => 8,
     "reports_customers_by_salesman_print" => 8,
     "reports_customers_by_salesman_export" => 8,
     "reports_customer_codes" => 8,
     "reports_branch_codes" => 8,
     "users_list" =>  14
  }.freeze unless defined? SECURITY_LEVEL

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to