[code language=”ruby”]
1. views
class ApplicationController < ActionController::Base
helper :all# include all helpers
end
2. Controller methods in views
class ApplicationController < ActionController::Base
helper_method :current_store
#now controller_method can be accessed in views
end
2. Helper methods in controller
class ApplicationController < ActionController::Base
include ActionView::Helpers::ApplicationHelper
end
3. Helper methods in model
class Teacher < ActiveRecord::Base
include ActionView::Helpers::ApplicationHelper
end
4. Helper methods in mailer
class Student < ActionMailer::Base
add_template_helper(ApplicationHelper)
end
[/code]
Recent Comments