Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # So, in erb templates and partials I want to use both @work_queue and @users.
- # @work_queue is visible, but @users is not.
- # Moving the declaration of @users to the protected method makes @users available.
- # I don't understand the scoping.
- # Fails when RAILS_ENV = test, success for development/production
- class Queues::WorkQueuesController < ApplicationController
- layout 'basic'
- before_filter :find_work_queue, :only => [:show, :refresh_panes]
- def show
- if @work_queue.nil?
- flash[:exclamation] = "You do not have access to that work queue."
- redirect_to secure_back
- end
- @users = @work_queue.team.users.inject({}) { |users, user| users[user.id] = user; users } if @work_queue
- end
- protected
- def find_work_queue
- @work_queue = sentry.user.active_work_queues.detect {|q| q.id == params[:id].to_i}
- end
- end
Add Comment
Please, Sign In to add comment