Роман Ярыгин
2014-Feb-03  09:36 UTC
Is Array constants in the model can be changed during runtime?
Hello everyone!
 
I have strange problem. Here is the code: 
 
model: 
 
class ItServiceJob < ActiveRecord::Base
TYPES = [["Important", 0], ["Not important", 1],
["SERGEY", 2]]
belongs_to :userend
view (haml): 
 
  %div{:role => "main", :class => "ui-content"}
    - job_types = ItServiceJob::TYPES
    - job_types.pop if (!can?(:manage, :it_service) || !can?(:born, :sergey))
    = job_types
    = form_for ItServiceJob.new, url: "#" do |f|
      
      %p
        = f.label :type
        = f.select :type, job_types
Now, when I refresh the page every time, the array pops one by one item and 
finally get empty! But, why? Why the constant changes, not variable? What 
I'm doing wrong?
-- 
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/fe1e76b2-f6e5-430d-8171-1f6616ce0de7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.