similar to: Strange Problem With Unwanted, Transient Caching

Displaying 20 results from an estimated 5000 matches similar to: "Strange Problem With Unwanted, Transient Caching"

2006 Jul 30
1
Bug? find_by_id(nil) returns object just created
Tried to submit a ticket in Trac, but it reported an error... Doing a Model.find_by_id(nil) after creating an object of type Model returns that object -- and the next time, returns nil. It should always return nil. For example, Step 1. Create an object: >> Foo.create(:name => "bar") => #<Foo:0x2aaaac3ade20 @new_record=false,
2009 May 14
3
Mysql query is not working
Please, Can anyone help me to execute this query? SELECT * FROM table WHERE customer_id IN (SELECT IF(1 <> 2,''SELECT customer_id FROM customers'',''SELECT customer_id FROM company'')) Regards... -- Posted via http://www.ruby-forum.com/.
2007 Dec 22
8
Rails 2.0 rescue_from
I am trying to use the new Rails 2.0 macro : rescue_from class PostsController < ApplicationController rescue_from ActiveRecord::RecordNotFound, :with => :deny_access ... def show @post = Post.find_by_id(params[:id]) raise ActiveRecord::RecordNotFound if @post.nil? #illegal access ..... end def deny_access respond_to do |format| format.html end end but the
2007 Jan 08
1
Realtime Voicemail Table Column Name Question
Hi All, In the realtime voicemail table the column 'customer_id' is used, for my purpose, to specify the customers accountcode. The column name 'accountcode' is used in the iax and sip tables. To keep this consistent throughout the tables, is there any reason I should NOT switch the column name 'customer_id' to 'accountcode' in the voicemail table? Does Asterisk
2007 Sep 21
2
ActionWebServer and SOAPFault
I''m really new to RoR and my first task is to write SOAP web service. The problem is that I don''t understand how to send custom SOAPFault messages in case of the errors. For example, I have FindCustomerById API signature: api_method :find_customer_by_id, :expects => [{:customer_id => :int}], :returns => [Customer] And controller: def
2013 Feb 18
6
How to clear ActiveRecord query cache on associations with dynamic table
In part of my application I''m using dynamic tables. I''m aware of the single thread conditions. I''ve tackled some caveats yet - will post a blog about it soon - but there''s one I need help with. Consider 2 models that are associated: Order and OrderLine where Order has many order_lines. Now we set the table names for them:
2008 May 21
3
Test returned value by sql statement
Hello people, just wanted to know how to actually test returned value from sql statement like : @alreadyused = Promotioncodes.find_by_sql [ "select alreadyused from promotioncodes where id = ?", @codeid ] I would like to check whether @alreadyused has value 1 or 0 It doesn''t seem a simple if @alreadyused would word ... Regards Joel
2006 Jun 27
3
find_by_id vs. find in postback action
I''m playing around with the Postback action recipe listed in the recipes book. Here is the default code given: def edit @recipe = Recipe.find_by_id(params[:id]) || Recipe.new if request.post? @recipe.attributes = params[:recipe] redirect_to :main_url and return if @recipe.save end end Here is what my code sort of ended up looking like, altho i''ve ripped it apart
2006 Apr 06
6
pagination question
i''ve figured out how to use the next and previous links with the paginator class but now i''m trying to figure out how to display all the page numbers in between. looking through the rails api, i found paginator.each() but i''m not sure how to use it, or if that''s even what i am looking for. also, is there a way to limit the amount of pages like some sites
2005 Dec 07
3
ActiveRecord::Observer problem
Hi all, I have a problem with an observer. I have a simple observer... class ActivityObserver < ActiveRecord::Observer observe Customer def after_create(model) bind_params(model) @al.action = "create" @al.save logger "#{model.id} : created" end private def bind_params(model) @al = ActivityLog.new @al.user_id = User.current.id
2006 Jul 10
3
finding particular record
Hi, I''m looking for a particular record from a view called ''charts''. The view ''charts'' joins data from a table ''record'' and a table ''owners''. I''m trying to pull up data from ''charts'' that lists certain data from ''record'' ie. I know i need record.id = 5. Is there a
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture- driven way of spec-ing or mocking. How the heck to you mock this so the code at line (2) and (4) work right? I''m still struggling with mocks but it seems like this can be done. Forgive the naivety of this question. 1. def change_quantity 2. @line_item = LineItem.find_by_id(params[:id]) 3. unless
2012 Aug 01
2
'redirect_to' taking infinite loop.
Hi, The following controller method taking me into infinite loop. Once the update action completes I want to reload the ''index'' page. May I know why it is going into infinite loop? def update Device.find_by_id( params[:device_id] ).driver = ( params[:driver_id] == 0 ) ? nil : Driver.find_by_id( params[:driver_id] ) redirect_to :action => :index, :tab =>
2006 Jul 13
2
find_by_id(nil) does not always return nil
I have a model named User. When running this application from the console I can call User.find_by_id(nil) and it returns nil. When running this application during testing or through WEBrick or Mongrel calling User.find_by_id(nil) returns the newest record in the database. But it only does this the first time you call it with nil. The second time you call User.find_by_id(nil) it returns nil.
2006 Jun 19
4
DateTimes get converted to Dates in XML-RPC????
Hi all - I have written an XML-RPC app using action-web-service. Mostly works well. Except I just noticed that my :datetime types are coming back as :date types. That is, when in the console I query the record via Foo.find_by_id(123) I get back actual datetimes. If I then do it via XML-RPC, fetching that same record I get back dates (ie. hour/minute/second are set to 00:00:00) Any ideas?
2006 Jun 17
2
how to delete a parent record and child records?
Wow, got myself lost as *soon* as I left the hand-holding exercises in the books. I''m trying to set it up so when I click the (scaffold-generated) ''destroy'' link on one (of a list) of parent MySQL records, the children records in a different table get deleted also. Very simple setup: my tables are ''customers'' and ''accounts'' class
2007 Dec 04
1
spec''ing shared controller methods
I want to isolate and spec methods that are shared by controllers, and live in application.rb. Whereas I usually also provide examples in individual controllers that use these methods, not necessarily all the edge cases and I''d like to isolate the examples. This is the approach I''m taking (thanks to bryanl for suggestions and http://pastie.caboo.se/123626). WDYT? This
2006 Apr 10
5
ActiveRecord: Behavior not doumented
Hello everbody, doing a #find(:first,an_id) with Rails 1.1.0 I expected that find returns the record which id mathches the given parameter an_id or nil if it couldn''t be found. This behaviour is documented on api.rubyonrails.org. But the find returns the first available object and not nil if an_id is not in the db. Is the doc on rubyonrails.org out of sync? Greetings, -- Daniel
2009 Oct 29
4
Unknown column 'quotes.organisation_id' in 'where clause': SELECT * FROM `quotes` WHERE (`quotes`.organisation_id = 1036)
Hi, I have a small app that needs to keep track of quotes, and organisations. An organisation can either be the unit who finally receives the goods (the end_user) or and intermediary (customer) (and in some cases both) An Organisation will (hopefully :) ) have many quotes; and a quote can belong to an organisation, either as a customer or as an end_user or both. So the quotes table
2006 Apr 03
1
Single table inheritance and relations
All, I''ve a question concerning STI in Rails. Let''s say I''ve a Person class and two classes that inherit from Person: User and Customer. In the DB I''ve the people table to store both instances of User and Customer. Now, let''s say I also have Address class, which references a Customer, and each customer has many addresses. How should I name the