Skip to content

Instantly share code, notes, and snippets.

@eins78

eins78/wtf.rb

Created Sep 14, 2015
Embed
What would you like to do?
rails controller instance var is cached if initialy assigned to const
class FooController < ApplicationController
KONST = {
foo: { bar: 'baz' },
}
def show
@konst = KONST
end
end
# --- in View: ---
# :ruby
konst = @konst.map do |key, value|
value[baz] = 'oops'
[key, value]
end.to_h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.