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?
job_types = ItServiceJob::TYPES.dup
--
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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@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.
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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a88c6898-929c-4cf2-b281-3b98217e5bd6%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLv20zw9G2jf6goe-X2g7EPx5VBTqJayYqGWG33XEDhRPg%40mail.gmail.com.