lib/plezi/handlers/controller_magic.rb in plezi-0.8.6 vs lib/plezi/handlers/controller_magic.rb in plezi-0.8.7

- old
+ new

@@ -201,11 +201,11 @@ (return render(options.delete(:layout), options) { render template, options, &block }) if options[:layout] # set up defaults options[:type] ||= 'html' options[:locale] ||= params[:locale].to_sym if params[:locale] # options[:locals] ||= {} - I18n.locale = options[:locale] if defined?(I18n) && options[:locale] + I18n.locale = options[:locale] || I18n.default_locale if defined?(I18n) # sets the locale to nil for default behavior even if the locale was set by a previous action - removed: # && options[:locale] # find template and create template object filename = template.is_a?(String) ? File.join( host_params[:templates].to_s, template) : (File.join( host_params[:templates].to_s, *template.to_s.split('_')) + (options[:type].empty? ? '': ".#{options[:type]}") + '.slim') return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( Slim::Template.new() { IO.read filename } ) ) : (Plezi.get_cached filename) ).render(self, &block) if defined?(::Slim) && Plezi.file_exists?(filename) filename.gsub! /\.slim$/, '.haml' return ( Plezi.cache_needs_update?(filename) ? Plezi.cache_data( filename, ( Haml::Engine.new( IO.read(filename) ) ) ) : (Plezi.get_cached filename) ).render(self, &block) if defined?(::Haml) && Plezi.file_exists?(filename) @@ -451,11 +451,11 @@ args.unshift ({_pl_method_broadcasted: method_name, _pl_ignore_object: ignore, _pl_target_object: target}) redis_connection.publish(redis_channel_name, args.to_json ) true end - # WebSockets. + # WebSockets: fires an event on all of this controller's active websocket connections. # # Class method. # # Use this to brodcast an event to all connections. # @@ -469,12 +469,10 @@ def broadcast method_name, *args, &block return false unless public_instance_methods.include?(method_name) __inner_redis_broadcast(nil, nil, method_name, args, &block) || __inner_process_broadcast(nil, nil, method_name.to_sym, args, &block) end - # WebSockets. - # - # Class method. + # WebSockets: fires an event on a specific websocket connection using it's UUID. # # Use this to unidcast an event to specific websocket connection using it's UUID. # # accepts: # target_uuid:: the target's unique UUID.