search for: module_ev

Displaying 20 results from an estimated 48 matches for "module_ev".

Did you mean: module_ex
2008 Jan 13
2
module_eval and scope question
...version of the code I''m trying to understand (in case you happen to use Rails: This is from file scaffolding.rb): module ActionController module Scaffolding .. module ClassMethods def scaffold(model_id, options = {}) ... unless options[:suffix] module_eval <<-"end_eval", __FILE__, __LINE__ def index list end end_eval end ... end end end The purpose of this code is to create at run-time the function ''index''. My question is: Why do I need '...
2012 Sep 11
1
define_method vs module_eval
Rails code: Accessors.send :define_method, :"default_#{name}", &block Accessors.module_eval <<-METHOD, __FILE__, __LINE__ + 1    def #{name}    -ISKimRw02aC5oVgD8gxYQQ@public.gmane.org(:#{name}, [])    end    def #{name}=(value)    value = value.present? ? Array(value) : default_#{name}    _set_detail(:#{name}, value) if value != @details[:#{name}]    end    remove_possi...
2006 Mar 13
1
adding custom cache field
...ethods) end module ClassMethods def belongs_to_extra(association_id, options = { }) association_type = association_id.to_s + "_type" if association_id association_primary_key = association_id.to_s + "_id" if options[:total_cache] module_eval( "after_create ''#{association_type}.constantize.modify_value(\"#{self.to_s.underscore.pluralize + "_total"}\",#{association_primary_key},#{options[:total_cache]})" + " unless #{association_type}.nil?''...
2006 Jul 22
1
How to debug this
...ems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `constantize'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active...
2006 Jan 09
1
Cooky Cookies
...:3001/cookie#>| Full Trace <http://localhost:3001/cookie#> c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in `const_missing'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/string/../../inflector.rb:149:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/string/../../inflector.rb:149:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/string/../../inflector.rb:149:in `constantize'' c:/ruby/lib/ruby/...
2006 Jul 26
1
Scaffolding Problems
.../activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `constantize'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/acti...
2006 Jan 10
1
Cooky cookies causes trouble
...000/cookies#>| Full Trace <http://localhost:3000/cookies#> c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in `const_missing'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/string/../../inflector.rb:149:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/string/../../inflector.rb:149:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/core_ext/string/../../inflector.rb:149:in `constantize'' c:/ruby/lib/ruby/...
2006 Jun 14
5
uninitialized constant error after scaffold on new Windows XP environment
...ems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `module_eval'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/inflector.rb:161:in `constantize'' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active...
2005 Dec 21
1
Table called applications - causes stack overflow?
...rt-1.2.4/lib/active_support/dependencies. rb:189:in `const_get'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/dependencies. rb:189:in `const_missing'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/core_ext/stri ng/../../inflector.rb:149:in `module_eval'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/core_ext/stri ng/../../inflector.rb:149:in `module_eval'' /usr/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/core_ext/stri ng/../../inflector.rb:149:in `constantize'' /usr/lib/ruby/gems/1....
2005 Jul 18
1
scripts/create_db
...p://wiki.rubyonrails.com/rails/show/SaltedLoginGeneratorQuickstart and worked through to where I want the create the db tables. Instead, I get script/create_db -bash: script/create_db: Permission denied [root@astarcc html]# ruby script/create_db ./script/../config/../lib/localization.rb:82:in `module_eval'':(eval):3:in `module_eval'': undefined method `render_body'' for class `Class'' (NameError) from ./script/../config/../lib/localization.rb:82:in `module_eval'' from ./script/../config/../lib/localization.rb:82 from /usr/local/lib/...
2006 Jul 23
8
belongs_to :through ?
Suppose I have a belongs_to relationship and the thing it belongs to, belongs in turn to something else. For example, I would like to do: belongs_to :city belongs_to: :county, :through => :city While it is not too much trouble to do obj.city.county, there are times when I need to iterate through the attributes and include this second-order attribute. Special code to handle this messes up
2006 Mar 03
6
has_one :next - invalid name?
I have this in a model: has_one :next, :class_name=>''WorkPart'', :foreign_key=>''next_id'' And it causes this error: compile error /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/deprecated_associations.rb:83: void value expression
2012 Jan 15
1
NoMethodError: undefined method `expect'
...t; expect { 2/0 }.to raise_error ruby-1.9.2-p290 :006?> end NoMethodError: undefined method `expect'' for #<Class:0x007fe272270590> from (irb):5:in `block in irb_binding'' from .../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in `module_eval'' from .../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:201:in `subclass'' from .../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:187:in `describe'' from .../.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8....
2005 Aug 16
1
Defining model classes for enumerations
...raise ArgumentError, ''An enum specification must contain a :class_name'' if class_name.empty? order = spec[:order] || ''position'' table_name = spec[:table_name] || class_name else class_name = spec end module_eval("class #{class_name} < BoilerPlate::EnumRecord; end") enum_class = const_get(class_name) enum_class.table_name = table_name enum_class.preload(:order => order) # mixed-in somewhere else end end end Used like this in, say, environment.rb EnumR...
2008 Mar 16
0
bypassing verify_authenticity_token before_filter when in facebook
...lt into Rails 2.0) under certain conditions. However, since my project works outside of Facebook I don?t want to disable the CSRF protection from requests made outside of Facebook. Here is a small extension i wrote for the ForgeryProtection module. ActionController::RequestForgeryProtection.module_eval do alias :original_verify_authenticity_token :verify_authenticity_token def verify_authenticity_token(*args) if controller.params.include?(''fb_sig'') && controller.action == ''sekret_method'' # Pretend to call this before_filter....
2006 May 09
6
Create checkboxes on page using contents of a hash
Hi all, I have a hash that is created in the index method of my controller. After it is created, the index.rhtml page is rendered. Upon this rendering I would like to create a check box for each key/value in the hash. The has is @recordsHash I have been trying varying stratagies like the one below, but to no avail. Do you have any ideas? Thanks for your help on this! html
2006 Jan 10
7
All My Rails Apps Died Over the Holidays
...ompile error ./script/../config/../app/views/time/list.rhtml:4: Invalid char `\212'' in expression repeated over and over. Refreshing the page gives thes same error but for seemingly random parts in the rhtml files. The application trace is: #{RAILS_ROOT}/app/views/time/list.rhtml:4:in `module_eval'' -e:3:in `load'' -e:3 I tried reinstalling Ruby and rebooting and doing a gem update, but nothing seems to affect it. Any suggestions? -- Posted via http://www.ruby-forum.com/.
2006 Jul 02
7
How can I intercept attribute calls?
Hi. I have two types of fields in my database, e.g. "name" and "name_ru". First one is a user''s name in english and the second one is in russian. I want to intercept calls like "c.name" and add "_ru" to it if current language is russian (I have my own Locale class like n Globalize). So I want such thing: -- Locale.set("en-US") c.name
2007 Dec 12
3
undefined method: controller_name
...t/controllers/application_controller_spec2.rb:10: undefined method `controller_name'' for Spec::Rails::Example::RailsExampleGroup::Subclass_1:Class (NoMethodError) from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:39:in `module_eval'' from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb:39:in `describe'' from /Users/alvin/workspace/eTriever-spec-tmp/vendor/plugins/rspec/lib/spec/extensions/class.rb:14:in `instance_eval''...
2008 May 28
3
Plug-in support for Camping Apps
# camping_plugin.rb # plug-in support for Camping Apps # require ''lib/camping_plugin'' # override R helper method to your liking :-) module Camping module PluginHelpers def R_with_module(c,*g) p,h=/\(.+?\)/,g.grep(Hash) g-=h raise "bad route" unless u = c.urls.find{|x| break x if x.scan(p).size == g.size &&