search for: private_methods

Displaying 11 results from an estimated 11 matches for "private_methods".

Did you mean: private_method
2006 Dec 21
3
Speccing private class methods
Hi How can I specify that a private method of a class gets called? If you run the code below, only spec (1) passes. Spec (2) is what I found causing problems in my code, and class (3) is my failed attempt to work around it. (3 really puzzles me - why is a private class method not accessible via send?) Another problem is that stub! makes public methods, which changes the behaviour of
2007 Mar 19
0
action_web_services error with rspec_on_rails
...tance of TestingCrudController" do controller.should be_an_instance_of(TestingCrudController) end end # more contexts - I believe the revelent code stops here context "model_name" do testing_crud_setup specify "should be a private method" do controller.private_methods.include?("model_name").should == true end specify "should be the controller name" do controller.send(:model_name).should == "TestingCrud" end end context "generic_variable" do testing_crud_setup specify "should be a private method&...
2008 Jun 12
0
named_scope doesn''t check for critical method names.
I just entered this ticket. http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/404-named_scope-bashes-critical-methods It turns out that in an ActiveRecord model like this Model << ActiveRecord::Base named_scope :public private def private_method end public def public_method end end The method public_method will be private because named scope
2006 Mar 12
2
Find all the methods on a object in an irb session?
How can I find all the methods on an object from withing irb? Thanks, Joe
2007 Apr 11
0
Fwd: [ mocha-Feature Requests-5856 ] Stubbing of private methods should be allowed
...instance_method.rb (revision 57) +++ lib/stubba/instance_method.rb (working copy) @@ -13,8 +13,9 @@ # intentionally empty end - def exists? - stubbee.respond_to?(method) + def exists? + #stubbee.respond_to?(method) + (stubbee.methods | stubbee.private_methods).include?(method.to_s) end end ---------------------------------------------------------------------- >Comment By: James Mead (jamesmead) Date: 2007-04-11 14:31 Message: I don''t know whether you have noticed, but this has accidentally become possible in more recent vers...
2006 Jul 05
2
Serialized object behaves weird
Hi! I got a class named EinsatzFilter which I serialized to session. Before saving to session it works afterwards I keep getting the message: "undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from ActiveRecord::Base inherited class. Code: class EinsatzFilter include ApplicationHelper attr_reader :personen, :monat, :projekte, :kunde
2007 Sep 14
4
Refactoring ActiveRecord's private methods
As it currently stands, ActiveRecord has alot of private and protected methods in the Base class. >> ActiveRecord::Base.methods.size => 427 >> ActiveRecord::Base.protected_methods.size => 32 >> ActiveRecord::Base.private_methods.size => 193 I really loved the suggestion by Courtenay in Refactoring AR::Base.find (http://groups.google.com/group/rubyonrails-core/ browse_thread/thread/2ff2b3ce6732096f/776dae05ffa2d445). It not only makes extending find calls easier, but all wraps up all the find logic in one class. I whip...
2006 Jun 30
6
RSS::Parser Documentation
Hi I am trying to use the RSS classes from "rss/2.0" and everything works but I want to know what attributes and properties I can get at from each of the classes I am getting back. For example, the class has a "channel" which I can tell has a "title" attribute (because it works when I query it :) but I would really like a list of every attribute that is
2005 Dec 27
3
myObject.send(column.name) from Agile Development book
I''m studying the Agile Development with Rails book. In the chapter that first sets up the depot application (page 68), there is this bit of code from a view: <% for product in @products %> <tr> <% for column in Product.content_columns %> <td><%=h product.send(column.name) %></td> <% end %> etc... I am trying to absorb both Ruby and
2005 Mar 09
21
Converting time retrieved from MySQL
I''m having a problem converting a date retrieved from my MySQL database and I''m hoping someone can help. MySQL stores the date/time as this: 2005-03-08 17:00:34.0 and according to my Pickaxe book Ruby stores times as "the number of seconds and microseconds since [...] January 1, 1970". All well and good. Unfortunately, RoR is converting my date to this:
2010 Jul 16
31
Added associations but don't see generated methods
Hi, I''ve got a Rails app working that includes two two classes, etc.: Expense & Vendor. I eventually learned that the mental concept I had of their relationship should be express in Rails as: class Expense < ActiveRecord::Base; belongs_to :vendor; end class Vendor < ActiveRecord::Base; has_many :expenses; end