Ruby on Rails Monday, February 3, 2014

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 :user  end

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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
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.

No comments:

Post a Comment