similar to: is there an activerecord method like "FIND EXISTING OR CREATE NEW IF NONE FOUND"?

Displaying 20 results from an estimated 20000 matches similar to: "is there an activerecord method like "FIND EXISTING OR CREATE NEW IF NONE FOUND"?"

2009 Jan 11
6
Why does ActiveRecord allow perception of success when updating an ID, however it doesn't really work(i.e. no change in database)?
Hi, Why does ActiveRecord allow perception of success when updating an ID, however it doesn''t really work(i.e. no change in database)? Here''s an example. The update of "id" versus update of a non-existent attribute. ?> ai = AccountItem.find(:first) => #<AccountItem id: 1, account_id: 1, date: "2009-01-11", amount:
2008 Feb 08
4
x-post : find_or_initialize_by ActiveRecord bug? Ignores :conditions
Hello, I posted this on the rails talk group but received no response. Perhaps someone on this list could weigh in on whether this is expected/desired behavior or a bug that I should file and develop failing tests for (I doubt I have the active record method_missing fu to actually patch it). Test Scenario: I would like to find or initialize a new user and base the find on the users email
2008 Feb 07
1
ActiveRecord 'find_or_initialize_by' dynamic finder bug? Ignoring conditions.
Hello all, I just ran into something that I think is a bug, and I would like to confirm with the core team whether this is expected/desired behavior or if this is a bug that I should file and develop failing tests for (I doubt I have the active record method_missing fu to actually patch it). Test Scenario: I would like to find or initialize a new user and base the find on the users email
2006 Apr 02
2
Delaying table attribute load using ActiveRecord
Hi all, I came accross the following problem lately: I got a table with several BLOB fields (Oracle DB) and I have ActiveRecord reading those fields whenever records are loaded using finder methods. This behavior is just fine in 99.9% of the time, but considering BLOB data is not small, it is considerably slowing down search access :(. So basically, I thought about building a :has_one
2006 Mar 12
3
Newbie: using find like a sql join query
I have a working Rails app with several related tables, but can''t find an answer to this question in the Dave Thomas Rails book. Imagine for example: table departments with columns: id, department_name table employees with columns: id, department_id, employee_name and of course the employees table has a constraint foreign key (department_id) references departments(id) So this is
2006 Nov 27
2
changing activerecord associations at runtime
Is there any way to change the associations of a model at runtime, like before running a specific query? Chris --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from 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
2008 Feb 01
5
ActiveRecord - find
Hi- What I would like to do is select a single column out of my model, say the column is called my_column, and store the result in an array, which it should be, right? For example, if I do: @my_arr = Model.find(:all, :select => "my_column") This should fill @my_arr with all the values from "my_column", right? So then I can access the data by some_other_variable =
2008 Nov 07
15
any tricks re using " eql(5.5)", but where 5.5 is a decimal not float?
-- Sent from my mobile device
2007 May 27
4
when will "TODO" comment/rake support come out?
Hi - quick question: when will "TODO" comment/rake support come out? Tks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to
2009 Sep 25
8
Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???
any pointers / suggestions re cheapest Rails hosting where they give you full access to Apache (to load modules etc)??? Can be a shared platform, however not sure if there is a shared platform type hosting service where they do give you such access?
2006 Jul 15
13
Active Record: Can it auto-create database tables for you?
Hi, Just get started with Rails and I''m trying to read ahead and find out whether Active Record supports auto-creation of database tables for you? Is this supported, or is the concept that you write your own database DDL to do this? Thanks -- Posted via http://www.ruby-forum.com/.
2007 Feb 05
10
how does Mocha compare in terms of classical vs mock-based testing, and stubbing???
Hi guys, I''ve just been reading Martin Fowler''s article re mock versus stubbing<http://martinfowler.com/articles/mocksArentStubs.html>where he compares traditional TDD testing techniques with mock based testing. I''d be interested in comments from a ruby on rails perspective in terms of this and Mocha? For example: a) Do you see Mocha as a robust way to test Ruby
2008 May 30
9
find_by_sql without a model? how to do this?
Hi, I''d like to do a "find_by_sql" without a model (e.g. <model name>.find_by_sql("...")) as the results I get back are a once off special, and I''m happy to handle them as an array. How do I do this? "ActiveRecord::Base.find_by_sql(...)" does not seem to work? Background - At the moment I''m doing within a model <model_name>,
2008 Nov 06
8
anyone able to explain logic behind "rake spec" startup (e.g. db:test:prepare => abort_if_pending_migration => invoke environment => etc etc)
anyone able to explain logic behind "rake spec" startup? i.e. the below steps & why things occur when they do Macintosh-2:myequity greg$ rake spec --trace (in /Users/greg/source/myequity) ** Invoke spec (first_time) ** Invoke db:test:prepare (first_time) ** Invoke db:abort_if_pending_migrations (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute
2006 Jul 30
3
Returning custom error messages in ActionWebService
I want to return my own error messages from an API instead of letting the client see the stack trace. I''m returning a custom structure so I guess I could just put a member in that structure for the error message, although that seems like kind of a hack. Any suggestions? Chris
2006 Jul 26
9
RadRails config? Getting blank project only created?
Hi, Does anyone know how to correctly configure RadRails (0.7)? I can''t seem to get 0.7 version of radrails to create a Rails project. All I get is a blank project. I have ensured that my PATH does point to my ruby\bin area. Also any clarification regarding which directory (with an example) should be used for the following preferences setting (are they asking for a file or
2007 Nov 23
2
Create my own dynamic "finder" method?
Hi all I''m having an authorization method that looks like the following: def user_requests_authorization_to(right_name) ... end I find it boring to always use user_requests_authorization_to(''EDIT'') user_requests_authorization_to(''CREATE'') etc., so I thought I could implement my own dynamic method, like the dynamic finders! Instead of the calls
2006 Aug 07
16
Monthly billing and payment processor recommendations?
Hi, I''m setting up a site that will bill on a monthly basis. I would rather not have to worry about storing customer credit card information. Does anyone have recommendations on payment processors that offer monthly billing services? I don''t want to go the paypal route as I want the user to stay on the site. I''m hoping to find an API to integrate with. I have
2006 Jul 25
3
create production tables? use "rake db:migrate"?
Hi, What is the normal mechanism for creating the tables in the (a) test and (b) production databases. For example the following didn''t work for creating the production tables: a) change environment.rb to include "ENV[''RAILS_ENV''] ||= ''production''" b) run "rake db:migrate" However this seemed to still work against DEV not