Sha256: df28680a63e7a1055a621a2853b034f7bc40b62bcd666f66f46bca163736e0a5
Contents?: true
Size: 1 KB
Versions: 15
Compression:
Stored size: 1 KB
Contents
class ApplicationController < ActionController::Base include InheritedResources::DSL protect_from_forgery def include_jqueryui content_for :head do stylesheet_link_tag("ui-lightness/jquery-ui-1.8.4.custom") javascript_include_tag("jquery-ui") end end load_main_menu def self.resource_attributes(*parameters) for action in [:show, :new, :edit, :create] a = "def #{action};" + ([:new, :create].include?(action) ? "@#{resource_class.name.underscore} = resource_class.new;" : "" ) + parameters.map{|p| if p.class == Hash meth, prm = [p.to_a.flatten[0], p.to_a.flatten[1]] else meth, prm = [p, p] end meth = meth.to_s + "=" if prm == :current_user val = "current_user" else val = "params[:#{prm}]" end "resource.send(\"#{meth}\", #{val})" }.join(";") + ";#{action}!;end;" class_eval a puts a end end end
Version data entries
15 entries across 15 versions & 1 rubygems