Re: [Rails] how instance_eval on Object class creating class methods and not instance methods?

2011-05-17 Thread Frederick Cheung
On 17 May 2011, at 02:20, John Merlino li...@ruby-forum.com wrote: THe guy says: The first instance_eval is used to add class method has_attribute into Object so that we can call it in all the inherited class. I'm a little thrown off by this statement. First, Object itself is an instance

[Rails] Re: Nested Resource w/ Collection

2011-05-17 Thread Eugen Ciur
The action 'posts' could not be found for UsersController http://localhost:3000/users/posts routes your request to UsersController#posts, but method 'posts' is not there. Add 'posts' method to UsersController, and your problem is solved. http://blog.eugen.co -- Posted via

Re: [Rails] Re: Nested Resource w/ Collection

2011-05-17 Thread Michael Pavling
On 17 May 2011 09:27, Eugen Ciur li...@ruby-forum.com wrote: The action 'posts' could not be found for UsersController http://localhost:3000/users/posts Add 'posts' method to UsersController, and your problem is solved. Or... you have just created a whole load of different problems... :-/

Re: [Rails] Nested Resource w/ Collection

2011-05-17 Thread Michael Pavling
On 17 May 2011 06:26, Chad Eubanks chadcreat...@gmail.com wrote: In my routes file I have the following nested resource:  resources :users do      collection do        get 'posts'      end    end PS Just to clarify, rather than collection you possibly want to use the syntax: resources

Re: [Rails] how instance_eval on Object class creating class methods and not instance methods?

2011-05-17 Thread Max Schubert
I think you are just confused by the overloaded use of the words objct and class as opposed to the ruby classes named Object and Class. This diagram / project might help clarify http://objectgraph.rubyforge.org/dotOG.html From http://objectgraph.rubyforge.org/ Max On 5/16/11, John Merlino

[Rails] Re: ActiveRecord - default ID vs custom identifier

2011-05-17 Thread comopasta Gr
Colin Law wrote in post #999008: On 14 May 2011 13:04, comopasta Gr li...@ruby-forum.com wrote: So my doubts are: - Should I set the custom identifier as the primary key and remove the default id? No - Or should I keep the default Id but instead fill it with the custom identifier? No

[Rails] Re: Rails 3 respond_with csv

2011-05-17 Thread mfilej
I've looked into this and it seems that there is no mechanism in AC that would call to_csv automatically. The code in action_controller/ metal/renderers.rb suggests that xml and json are just two special cases that do that. On Mar 31, 3:01 pm, mfilej miha.fi...@gmail.com wrote: Did you have any

[Rails] Help with authentication/authorisation design

2011-05-17 Thread Pingu Penguin
Could someone help me with an authentication/authorisation design please? It's for a car garage application that allows a customer to monitor the status of their car. Here are my requirements: 1. I need a heirarchy of 4 users: A. Superuser (me) B. Garage owner. C. Mechanic.

Re: [Rails] Re: ActiveRecord - default ID vs custom identifier

2011-05-17 Thread Colin Law
On 17 May 2011 11:06, comopasta Gr li...@ruby-forum.com wrote: Colin Law wrote in post #999008: .. Why store the tag identifier in the statistic? Externally the tag is known by its identifier. They are tags that are read with the mobile and when they come to the server they are found by

Re: [Rails] Re: setup Mysql / rails 3.0.3 Snow leopard 32bit

2011-05-17 Thread Bryan Crossland
Sent from my iPhone On May 16, 2011, at 1:33 PM, Rebecca Dias li...@ruby-forum.com wrote: Mike I am also a newbie. Where might I find this bundle file? It's called Gemfile and it's in the root of your application folder. B. -- Posted via http://www.ruby-forum.com/. -- You

[Rails] Re: REXML::ParseException - but the feed IS valid

2011-05-17 Thread Thomas Dalla
I still have the same problem with Ruby 1.9.2... === I 05/17/2011 21:56:20:387 1638 APP| Error: #REXML::ParseException: Declarations can only occur in the doctype declaration. Line: 39 Position: 2342 Last 80 unconsumed characters: ![CDATA[pSDM

[Rails] how to configure ruby-on-rails with apache

2011-05-17 Thread ashwini patel
Hello All, i have strugled in connection between java(jdk1.6_17) and ruby on rails under Webrick server... I am using IDE netbeans( version 7 ). dats why i need configure with apache (wamp 2.0)..i saw some tutorials about configuring..

Re: [Rails] how to configure ruby-on-rails with apache

2011-05-17 Thread Paulo Muggler Moreira
What environment are you coming from? Unix, Mac, Windows? Let's assume you're using some Unix variant, as you should, and Apache2 is already properly installed: 1. install phusion passenger: $ gem install passenger 2. install passenger-apache2-module: $ passenger-install-apache2-module Be sure

Re: [Rails] Re: REXML::ParseException - but the feed IS valid

2011-05-17 Thread Bryan Crossland
Sent from my iPhone On May 17, 2011, at 8:02 AM, Thomas Dalla li...@ruby-forum.com wrote: I still have the same problem with Ruby 1.9.2... === I 05/17/2011 21:56:20:387 1638 APP| Error: #REXML::ParseException: Declarations can only occur in

Re: [Rails] Re: ActiveRecord - default ID vs custom identifier

2011-05-17 Thread Paulo Muggler Moreira
Don't forget, you can also add a database index to a field that is going to be searched often, that will improve search performance. In your model's migration: add_index(table_name, column_names, options) from: http://api.rubyonrails.org/classes/ActiveRecord/Migration.html

[Rails] rails render_to_string problem

2011-05-17 Thread makaroni4
Hi I`m trying to test my controller with rspec and always get an error. The error is in the render_to_string method call (without it test works fine). So could u please help me with that? users_controller.rb: def update @user.update_attributes!(params[:user]) redirect_to @user, :status

[Rails] QA Testers QA with Selenium and Agile for Reston VA

2011-05-17 Thread Dice requirement
Hi This is Rama with quantum InfoTech QA Testers QA with Selenium and Agile for Reston VA Duration: 3 months + (strong likelihood of an extension) Location : Reston VA We are seeking QA Testers for a contract position in Reston, VA. -Will need to have solid web services testing experience.

[Rails] API testing case from within a rails app

2011-05-17 Thread Costa Nicolaou
After upgrading from rails 2.3.3 to rails 2.3.8, i've lost the ability to parse xml parms sent via tests using @request.env['RAW_POST_DATA'] = xml. Rails stopped parsing the content of the raw_post_data into params which made all the test that depend on this fail. I'm also setting @request.accept

Re: [Rails] Help with authentication/authorisation design

2011-05-17 Thread Paulo Muggler Moreira
Not sure I understand whether the problem is capturing the business relationships in your Rails models, or applying your authorization frameworks to your app. Hope this helps a bit: It seems to me you would want to associate your Customers, Mechanics, and Garage Owners to some sort of Garage

Re: [Rails] QA Testers QA with Selenium and Agile for Reston VA

2011-05-17 Thread Michael Pavling
On 17 May 2011 14:49, Dice requirement dice.requireme...@gmail.com wrote: This is Rama with quantum InfoTech Hi Rama, This is a Rails list... not a Selenium list. Sure, *some* here have experience with the tools you're looking for, but that's no excuse for the off-topic post. There are Selenium

Re: [Rails] Nested Resource w/ Collection

2011-05-17 Thread Chad Eubanks (gMail)
Michael, I initially I was using resources as oppose to collection. I ran take routes and users/posts is a valid route. Ultimately I am trying to keep a relationship between the two models but remove the user id from the URL. Kind Regards, Chad Eubanks The Code Boutique Sent from my

Re: [Rails] Nested Resource w/ Collection

2011-05-17 Thread Michael Pavling
On 17 May 2011 15:30, Chad Eubanks (gMail) chadcreat...@gmail.com wrote: Ultimately I am trying to keep a relationship between the two models but remove the user id from the URL. You can keep a relationship between models without *any* nesting of routes. Whether a Post belongs to a User, or

[Rails] Re: Help with authentication/authorisation design

2011-05-17 Thread Pingu Penguin
Thanks for the reply Paulo, my question was about the business relationships involved, and I think you went a long a way towards answering it. With regards to a Customer being associated with multiple Garages, good news, this is not possible, they would have to have separate accounts. Your

Re: [Rails] Nested Resource w/ Collection

2011-05-17 Thread Chad Eubanks
The end goal is this: I have a client app that is proxing json from the rails server. Our current way of using /users/id/posts.json as the url proxied does not work as needed. I would like to set a relation between the user and post model but NOT have a nested url. The desired scenario is

[Rails] Graphics application with rails and javascript

2011-05-17 Thread Jao rabary
Hi all, I'm trying to develop a video annotation application with Rails. First things I need to do is to select a bounding box of an object in a video frame and back it up in my database. From now I was able to draw some bounding boxes using javascript and the canvas elements of html5. But I

[Rails] Changing Rails Default Date Parse Option

2011-05-17 Thread TomRossi7
Does anyone know how to change the default option for the Date.parse (which ActiveRecord is using on all date fields). I would like the comp option to default to true so I don't have to account for 2- digit dates throughout my application. http://corelib.rubyonrails.org/classes/Date.html#M001228

[Rails] Configuring Rails App to handle multiple domains and multiple cookies

2011-05-17 Thread Gavin
I have a rails app which supports multiple domains and each domain may have multiple subdomains. Users visiting mydomain1.com do not receive the same experience as mydomain2.com (although the base behaviour of the apps is the same) Therefore, if a user is logged in to mydomain1.com, it shouldn't

Re: [Rails] Re: Help with authentication/authorisation design

2011-05-17 Thread Paulo Muggler Moreira
I think trying to model all those relationships solely in your user models will turn out way more complicated than adding a few extra models to your app to help capture those relationships. Your concerns about data coupling are valid, but at some point, you'll have to store the information about

[Rails] has_many through question

2011-05-17 Thread eddyjab
hi there, i thing i just have a logical problem. i have following models. class Area ActiveRecord::Base belongs_to :taskschedule belongs_to :service end class Service ActiveRecord::Base has_many :taskschedules, :through = :areas has_many :areas end class

Re: [Rails] Re: how to connect a form field to a table from another database?

2011-05-17 Thread Paulo Muggler Moreira
The way I understand it, Mauro has his models stored in different databases, i.e., his rails app is running on one DB server (SQLite/PostgreSQL/X) and he wants to fetch data on another DB server (Oracle), is that so? In that case, it would do good to look here:

[Rails] p.save not actually saving

2011-05-17 Thread james b.
i'm not sure if this is the right place for this but it its an activerecord issue so hopefully it is. anyway when ever i try and save a model it come back as true but when i find the object again it hasn't changed. For example: p = Post.find 1 p.title.capitalize! p.save # Returns true but

[Rails] Re: HTML snapshots for crawlable ajax

2011-05-17 Thread Kendall Gifford
On Monday, May 16, 2011 7:08:11 PM UTC-6, Ruby-Forum.com User wrote: Hi, There doesn't seem to be any reference for taking HTML snapshots from within a Rails server. I wonder how one could implement Google's crawlable AJAX spec

[Rails] migration to change data type of existing column from string to text

2011-05-17 Thread sol.manager
I have been poking around the rails guides section on migrations (http://guides.rubyonrails.org/v2.3.8/migrations.html#changing-tables) and trying to make sure I have the proper syntax to change a column type for an existing field from string to text (without losing data already entered). What is

Re: [Rails] Re: how to connect a form field to a table from another database?

2011-05-17 Thread Mauro
On 17 May 2011 18:30, Paulo Muggler Moreira paulomugg...@gmail.com wrote: The way I understand it, Mauro has his models stored in different databases, i.e., his rails app is running on one DB server (SQLite/PostgreSQL/X) and he wants to fetch data on another DB server (Oracle), is that so? Yes

Re: [Rails] p.save not actually saving

2011-05-17 Thread Tom Meinlschmidt
which rails? try (in console) p = Post.find 1 p.title.capitalize! p.title p.save p.errors.inspect tom On May 17, 2011, at 19:45 , james b. wrote: i'm not sure if this is the right place for this but it its an activerecord issue so hopefully it is. anyway when ever i try and save a

Re: [Rails] p.save not actually saving

2011-05-17 Thread Frederick Cheung
On 17 May 2011, at 18:45, james b. li...@ruby-forum.com wrote: i'm not sure if this is the right place for this but it its an activerecord issue so hopefully it is. anyway when ever i try and save a model it come back as true but when i find the object again it hasn't changed. For

Re: [Rails] has_many through question

2011-05-17 Thread David Kahn
On Tue, May 17, 2011 at 9:50 AM, eddyjab edja...@gmail.com wrote: hi there, i thing i just have a logical problem. i have following models. class Area ActiveRecord::Base belongs_to :taskschedule belongs_to :service end class Service ActiveRecord::Base has_many

[Rails] Rails ninja wanted

2011-05-17 Thread Chad Eubanks
Hi guys, My name is Chad Eubanks and I am the founder of a small team called The Code Boutique. We specialize in web development using Rails and Sproutcore. SproutCore is a html5 framework with Yehuda Katz on the core team. I am looking for another rails developer to help my team bridge the

[Rails] Re: uninitialized constant Delayed::Job (NameError)

2011-05-17 Thread Kendall Gifford
On Monday, May 16, 2011 11:36:30 PM UTC-6, News Aanad wrote: hi I am implementing delayed_job in my rails app. *my code is:* file name is: my_worker.rb require delayed_job require rubygems class MyClass def perform while true do puts I am in My class!!! sleep 2

[Rails] Re: unexpected results when extending methods to class Class and class Object

2011-05-17 Thread John Merlino
I still dont think I am fully clear on the Class class role. For example: ruby-1.8.7-p330 :010 class Class ruby-1.8.7-p330 :011? def is_a? ruby-1.8.7-p330 :012? puts 'a' ruby-1.8.7-p330 :013? end ruby-1.8.7-p330 :014? end = nil ruby-1.8.7-p330 :015 A.is_a? a = nil ruby-1.8.7-p330

[Rails] Re: rails render_to_string problem

2011-05-17 Thread Kendall Gifford
On Tuesday, May 17, 2011 6:40:26 AM UTC-6, makaroni4 wrote: Hi I`m trying to test my controller with rspec and always get an error. The error is in the render_to_string method call (without it test works fine). So could u please help me with that? Does the controller action run fine

[Rails] Re: has_many through question

2011-05-17 Thread eddyjab
i understand. i have 3 models. taskschedule, services and areas. each taskschedule has many services through the model area. when i add(create/update) services to taskschedule i want to enter also some information to the model area. hope that makes sence. thanks ed On May 17, 2:33 pm, David

[Rails] Re: how instance_eval on Object class creating class methods and not instance methods?

2011-05-17 Thread John Merlino
Let me see if I fully understand this. This: Object.instance_eval def a puts 'a' end end is equivalent to this: class Object def self.a puts 'a' end end Basically, instance_eval invoked on Object creates a new class method for the Object class (or for class Class? and if it is

[Rails] Disabling sessions for web crawlers

2011-05-17 Thread robinluc...@gmail.com
I'm upgrading our Rails app from 2.1 to 2.3.11. Yes, this is difficult. :-) Our application controller contains the following line: session :off, :if = Proc.new {|req| req.user_agent =~ BOT_REGEX} The purpose of this line is to prevent the creation of sessions for the Googlebot and other

[Rails] Rails newbie asking for help [simple question]

2011-05-17 Thread Stefan Gelenchev
First I want to thank the community for their help and here is my question :) I have a simple add to fdavourites functionality. A user can add a post to their favouirites. Thing is I want to display the add to favourites button if the post is not in the user's favs and something else if it is, so

Re: [Rails] Changing Rails Default Date Parse Option

2011-05-17 Thread Colin Law
On 17 May 2011 17:11, TomRossi7 t...@themolehill.com wrote: Does anyone know how to change the default option for the Date.parse (which ActiveRecord is using on all date fields).  I would like the comp option to default to true so I don't have to account for 2- digit dates throughout my

[Rails] Re: Help with authentication/authorisation design

2011-05-17 Thread Pingu Penguin
Thanks so much for your help Paulo, it's really appreciated. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe

Re: [Rails] Changing Rails Default Date Parse Option

2011-05-17 Thread TomRossi7
ActiveRecord, by default, parses strings using the Date.parse method. I'm trying to figure out how to tell it to use the comp=true option so it will parse two-digit years more logically. Currently, the default is false which allows you to say person.birthday= '10/29/75' and it parses that as

[Rails] Re: migration to change data type of existing column from string to text

2011-05-17 Thread sol.manager
Well googled a bit more as I am impatient. Credit for this answer goes to http://www.cowboycoded.com/2009/10/07/change-a-column-data-type-with-rails-migration/ Thanks cowboy. On May 17, 1:59 pm, sol.manager sol.mana...@gmail.com wrote: I have been poking around the rails guides section on

[Rails] Re: Rails newbie asking for help [simple question]

2011-05-17 Thread baldmark
I think you need .any? On May 17, 3:50 pm, Stefan Gelenchev li...@ruby-forum.com wrote: First I want to thank the community for their help and here is my question :) I have a simple add to fdavourites functionality. A user can add a post to their favouirites. Thing is I want to display the

[Rails] Re: Rails newbie asking for help [simple question]

2011-05-17 Thread Stefan Gelenchev
Played with the code for hours and just got it to work, 20 minutes after posting here. ruby-forum.com brought me luck, thank you :) Here the working code: % if current_user.favourites.exists? :post_id = @post.id % So it checks the favs of the current_user in the fawvourites table and compares

[Rails] Re: p.save not actually saving

2011-05-17 Thread james b.
Thanks very much i had been pondering on this for a while Final Solution: p.title = p.title.capitalize instead of p.title.capitalize! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to

Re: [Rails] Changing Rails Default Date Parse Option

2011-05-17 Thread Colin Law
On 17 May 2011 20:57, TomRossi7 t...@themolehill.com wrote: ActiveRecord, by default, parses strings using the Date.parse method.  I'm trying to figure out how to tell it to use the comp=true option so it will parse two-digit years more logically.  Currently, the default is false which allows

Re: [Rails] Changing Rails Default Date Parse Option

2011-05-17 Thread TomRossi7
On Tuesday, May 17, 2011 3:51:38 PM UTC-4, Colin Law wrote: On 17 May 2011 17:11, TomRossi7 t...@themolehill.com wrote: Does anyone know how to change the default option for the Date.parse (which ActiveRecord is using on all date fields). I would like the comp option to default to true

Re: [Rails] Changing Rails Default Date Parse Option

2011-05-17 Thread Tom Rossi
What does it matter where the data comes from? ActiveRecord parses it the same? If you don't know, or if it isn't possible, thats fine, but I don't want to overcomplicate the question. On Tue, May 17, 2011 at 4:21 PM, Colin Law clan...@googlemail.com wrote: On 17 May 2011 20:57, TomRossi7

Re: [Rails] Changing Rails Default Date Parse Option

2011-05-17 Thread Colin Law
On 17 May 2011 21:37, TomRossi7 t...@themolehill.com wrote: On Tuesday, May 17, 2011 3:51:38 PM UTC-4, Colin Law wrote: On 17 May 2011 17:11, TomRossi7 t...@themolehill.com wrote: Does anyone know how to change the default option for the Date.parse (which ActiveRecord is using on all date

[Rails] Can't dump File ... when uploading files

2011-05-17 Thread Erwin
I am getting this error on the redirect_to command ... I am using Rails 3 w Paperclip to upload files ( but I tried also CarrierWave .. same error) I tried to change the session store from cookie-based to database .. same error I tried to delete the params content ... I don't know what to try

[Rails] Re: Changing Rails Default Date Parse Option

2011-05-17 Thread dana tassler
Have you considered using the Chronic gem? I don't know how to do what you're asking but have recently implement Chronic to make date parsing more sane. (Actual verbiage from my assigned task.) It's quite a handy gem, you might consider implementing it. http://chronic.rubyforge.org/ On May 17,

Re: [Rails] Re: has_many through question

2011-05-17 Thread Bryan Crossland
Sent from my iPhone On May 17, 2011, at 1:58 PM, eddyjab edja...@gmail.com wrote: i understand. i have 3 models. taskschedule, services and areas. each taskschedule has many services through the model area. when i add(create/update) services to taskschedule i want to enter also some

[Rails] Re: rake db:create = LIBMYSQL.DLL not found. how to solve??

2011-05-17 Thread Chaitanya M.
This worked for me. A minor correction: libmysql.dll is in mysql/lib folder and paste it to your ruby/bin folder!!! Yacobus Reinhart wrote in post #664497: [1] gem install mysql [2] you will see like error syntac but dont pay attention to it [3] find LIBMYSQL.DLL from your mysql/bin folder in

Re: [Rails] Changing Rails Default Date Parse Option

2011-05-17 Thread Tom Rossi
On Tue, May 17, 2011 at 4:54 PM, Colin Law clan...@googlemail.com wrote: On 17 May 2011 21:37, TomRossi7 t...@themolehill.com wrote: On Tuesday, May 17, 2011 3:51:38 PM UTC-4, Colin Law wrote: On 17 May 2011 17:11, TomRossi7 t...@themolehill.com wrote: Does anyone know how to change

[Rails] Re: unexpected results when extending methods to class Class and class Object

2011-05-17 Thread Frederick Cheung
On May 17, 7:43 pm, John Merlino li...@ruby-forum.com wrote: I still dont think I am fully clear on the Class class role. For example: ruby-1.8.7-p330 :010 class Class ruby-1.8.7-p330 :011?   def is_a? ruby-1.8.7-p330 :012?     puts 'a' ruby-1.8.7-p330 :013?     end ruby-1.8.7-p330

[Rails] Re: has_many through question

2011-05-17 Thread eddyjab
here is the taskschedule#new view %= form_for @taskschedule, :url=taskschedules_path do |f| % pArea: %= f.text_field :name %/p % for service in Service.find(:all) % p%= check_box_tag :service_ids, service.id, @taskschedule.services.include?(service), :name =

Re: [Rails] Re: p.save not actually saving

2011-05-17 Thread Tom Meinlschmidt
or p.update_attribute(:title, p.title.capitalize) and without p.save or if you want to capitalize in your model (when saving), you could do that with before filter before_save do |row| row.title = row.title.capitalize unless row.title.blank? end tom On May 17, 2011, at 22:17 , james b.

[Rails] Select not maintaining state on nested form with

2011-05-17 Thread David Kahn
I am using nested forms with multiple instances of various of the forms. The problem I cant figure out is how to maintain state for the select between postbacks. I am using 'options_from_collection_for_select' and in this the last param is to be the selected value, but given the dynamic nature,

Re: [Rails] Re: has_many through question

2011-05-17 Thread David Kahn
On Tue, May 17, 2011 at 4:38 PM, eddyjab edja...@gmail.com wrote: here is the taskschedule#new view %= form_for @taskschedule, :url=taskschedules_path do |f| % pArea: %= f.text_field :name %/p % for service in Service.find(:all) % p%= check_box_tag :service_ids,

Re: [Rails] Can't dump File ... when uploading files

2011-05-17 Thread David Kahn
On Tue, May 17, 2011 at 4:01 PM, Erwin yves_duf...@mac.com wrote: I am getting this error on the redirect_to command ... I am using Rails 3 w Paperclip to upload files ( but I tried also CarrierWave .. same error) I tried to change the session store from cookie-based to database .. same

Re: [Rails] Disabling sessions for web crawlers

2011-05-17 Thread David Kahn
On Tue, May 17, 2011 at 2:32 PM, robinluc...@gmail.com robinluc...@gmail.com wrote: I'm upgrading our Rails app from 2.1 to 2.3.11. Yes, this is difficult. :-) Our application controller contains the following line: session :off, :if = Proc.new {|req| req.user_agent =~ BOT_REGEX} The

[Rails] Tailing Error

2011-05-17 Thread Mohamed L.
Hi, I'm trying to use the command tail and it keeps on saying: 'tail' is not recognized as an internal or external command, operable program or batch file. I've installed the gem 'file-tail' to try to solve this, but I'm not really sure that this gem is what I'm looking for cuz it still doesn't

[Rails] Re: changing routes.rb

2011-05-17 Thread Mohamed L.
it worked ofcourse. Thanks again. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send

Re: [Rails] Re: how instance_eval on Object class creating class methods and not instance methods?

2011-05-17 Thread Adam Stegman
It's not defining it on Class, it's defining it on the Object class. Every class inherits from Object, so every class inherits that class method. If you define it on a different class, it will belong to that class and its descendants: String.instance_eval do def test_method test end