ruby on rails - Set content_for for all pages on the site -


i have yield in application.html.erb,

<%= yield(:alert_area) %> 

... , want set content area every page on site (that uses layout). content cannot hardcoded in view because must display in situations (i.e. "your profile incomplete, click here complete it!")

how can this? can know can try using content_for in applicationcontroller seems breaking mvc pattern putting content in controller. plus, hitting dead end doing way anyway.

what proper rails mvc way stick dynamic content on every page of site?

as bukk530 suggests, instead of yield/content_for construct use render/partial construct, , in partial have conditional renders when want to. eg.

- flash.each |name, message|   %div{ class: "flash flash-#{name}" }= message 

Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -