Will not be useful functionality similar https://github.com/shell/rails3_before_render ? Something like ActionController filters but not before action. Filters before render. See also http://www.perfectline.ee/blog/ruby-on-rails-before-render-filter, http://penkin.co.uk/rails3_before_render-plugin/. And don't you know gem for this? Thanks.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/VVF2HksqidUJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/LpTEwnRYIEUJ.
Will not be useful functionality similar https://github.com/shell/rails3_before_render ? Something like ActionController filters but not before action. Filters before render. See also http://www.perfectline.ee/blog/ruby-on-rails-before-render-filter, http://penkin.co.uk/rails3_before_render-plugin/. And don't you know gem for this? Thanks.
class ApplicationController
def render(*args)
unless @we_already_prepared_js_vars
@we_already_prepared_js_vars = true # This is to avoid loading those variable for each call of render
@_js_vars = prepare_js_vars
end
super
end
end
class UserController < ApplicationController
before_filter :load_user
def prepare_js_vars
{record_created_at: @user.created_at}
end
def load_user
@user = User.find params[:id]
end
end
ApplicationController
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-core/ockZdwf00VM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-co...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.