Hi, Constants in Ruby are "contantish". And in your case you're passing the array reference to job types, so any changes that you do in job_types it goes to ItServiceJob::TYPES.
With that being said what you need to do is duplicate the ItServiceJob::TYPES. Change the job_type assignment with: job_types = ItServiceJob::TYPES.dup Regards, *Marco Antonio Almeida*+45 31 65 28 84 Twitter: @marcoafilho <http://www.twitter.com/marcoafilho> | LinkedIn: marco-antonio-almeida-filho<http://www.linkedin.com/pub/marco-antonio-almeida-filho/53/399/3a2> On Mon, Feb 3, 2014 at 10:36 AM, Роман Ярыгин <[email protected]> wrote: > 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 [email protected]. > To post to this group, send email to [email protected]. > 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. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACMkcE5fgc2O8%2BYEhk%2BnU388HCh6_dYGqcdA1i-dhvm-af1wcQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

