Module: InheritedRailsViews::InstanceMethods

Defined in:
lib/inherited_rails_views.rb

Instance Method Summary collapse

Instance Method Details

#inherited_attributes(*args) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/inherited_rails_views.rb', line 52

def inherited_attributes(*args)
	if args.empty?
		@_inherited_attributes || _default_inherited_attributes
	else
		_set_inherited_attributes(*args)
	end
end

#irv_t(lazy, options = {}) ⇒ Object

would like to have this in a helper, which doesn’t work



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/inherited_rails_views.rb', line 35

def irv_t lazy, options = {}
	options[:default] = [
			:"#{params[:controller]}.#{lazy}",
			:"application.#{params[:action]}.#{lazy}",
			:"application.#{lazy}",
			:"#{lazy}"
	] + [*options[:default]]

	options.reverse_merge!({
			                       :resource => resource_class.model_name.human,
			                       :action => params[:action],
			                       :controller => params[:controller]
	                       })

	I18n.t("#{params[:controller]}.#{params[:action]}.#{lazy}", options)
end