ruby - Rails with HAML template Engine how label works in Haml? -


i new haml , not able understand old coder logic try identify label come on ui in haml template code main view page

  = render :partial => "application/select_search", :locals => {:n => "benefit_stream_inf", :options => @dynamic_benefit_options, :default => true} 

select_search page render in main plage

label = local_assigns[:l] ? l : t(n, :scope => local_assigns[:s] ? s : :models) 

now not give label in render how lable generated

can 1 explain label assignment code

label = local_assigns[:l] ? l : t(n, :scope => local_assigns[:s] ? s : :models) 

finly got answer

label = local_assigns[:l] ? l : t(n, :scope => local_assigns[:s] ? s : :models) 

local_assigns[:l] local variable used give label directly

t(n, :scope => local_assigns[:s] ? s : :models) used fatch label value of translation file pass key , scope

and translation file put @ config/local/en.yml


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -