function - Fuctions in Rails -
how can pass function application_controller application.html.erb?
i have left bar in application.html.erb , have show links. in application_controller have vars , want pass them application.html.erb. help?
q1: how can pass function application_controller application.html.erb?
a. cannot pass method controller view, instead can write method in helper. helper method accessible view.
q2: in application_controller have vars , want pass them application.html.erb.
a. can use instance variable in controller. instance variables accessible in view. use instance variables, put @ before variable name in controller, eg: @name="manchester united" or @food_preferences = foodpreference.all , use @name or @food_preferences in view(in case application.html.erb) ruby tag.
Comments
Post a Comment