similar to: How to rubify this query

Displaying 20 results from an estimated 300 matches similar to: "How to rubify this query"

2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
Hi... Isn''t there a proper way or hack/workaround for the following? * For the example with unfortunate disabilities.. look below,,, Usage of has_* (associationmethods) do {def with_deleted AccociatedModel#with_scope} {Paranoid''s#find_with_deleted}... The has_one associations give me a nil object when invoking it with Model.association_OBJECT.with_deleted. Has_many does like
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to, habtm, and the new has_many => :through relationships. Whenever I try a find(:all, :conditions => "some conds", :include [:relationship]) it works fine, but if I have find(:all, :conditions => "some conds", :include [:relationship, :other_relation]) it gets a sql error such as Mysql::Error: You
2011 Nov 18
1
What does :count actually mean in assert_select?
Hi guys, I tried reading up the RSPEC Book (Dec 2010) and googled a bit but I could not find anything. I''m using Rspec2. Example: spec/factories/categories.rb ====================== FactoryGirl.define do factory :category_intakes, :class => ''category'' do name ''intakes and filters'' description ''airfilters and
2006 Jan 20
11
Userstamp Plugin
I''m pleased to announce a new plugin for Rails: Userstamp. You can read my blog post at http://www.delynnberry.com/articles/2006/01/20/userstamp-plugin and/or read all about it at the perminant page http://www.delynnberry.com/pages/userstamp. Any comments or suggestions for improvement are much appreciated. -- DeLynn Berry delynn@gmail.com http://www.delynnberry.com A dump of the Readme
2006 Dec 06
2
validates_uniqueness_of where scope euqals created_by "magic" field
I have the following ActiveRecord objects: class Recipe < ActiveRecord::Base has_many :ratings, :dependent => true . . . end class Rating < ActiveRecord::Base validates_uniqueness_of :created_by, :scope => :recipe_id belongs_to :recipe, :counter_cache => true . . . end The created_by field on Rating is implemented as a "magic" field similar to this:
2006 Sep 26
0
Find Returning String Instead of Integer?
Any ideas on why this is? The quantity field in mysql is INT, but I get back a string? This is preventing me from using the increment method. >> @cart = Cart.new => #<Cart:0x2730f40 @new_record=true, @attributes={}> >> @cart.items << Item.find(:first) => [#<Item:0x272d6ec @attributes={"vendor_id"=>"1",
2006 Dec 11
1
Index help on Polymorphic Associations
Hello, I''m a newbie to aaf and rails and I hope anyone can help me with this. I have the following Models: class Project < ActiveRecord::Base acts_as_authorizable acts_as_audited :except => [:created_by, :updated_by ], :user_class_name => ''AuthenticatedSystem'', :user_method => ''current_user'' acts_as_ferret :fields => {:name =>
2006 Feb 26
3
Rails Naming Conventions
DB field names: If I have a table that references 2 or more separate users from my users table, is there a recommended naming convention for this situation? In my case, I have 3 users associated with a record in my projects table: requester_user_id created_by updated_by I could name one of them "user_id", and then projects.user would work I guess, but wouldn''t work
2006 Jul 18
1
usermonitor / user stamping active record
Quick question about userstamping records in a similar way to timestamping. There is an example of how this might work at: http://wiki.rubyonrails.org/rails/pages/Howto+Add+created_by+and+updated_by/versions/7 This seems to work fine on my development system. However, I am not sure how the User.current_user method, which is required, can guarantee to return the correct user since this is a
2006 Sep 09
13
best way to add "created_by" entries to all tables???
Hi, I want to automate somewhat the addition of created_by/updated_by fields on my models (i.e. to include username). What''s the best/recommended way to do this? Would it be to: a) Find out how to extend the ActiveRecord::Base itself (I haven''t extended a class before yet) b) Use a plugin type approach where you have to add a tag manually to each model file which then
2006 Aug 12
0
insert into database failing
hi all, i am trying a little project based on the agile book''s shopping cart example and have hit a problem. the inserts are failing when saving a quote which contains line_items. the models are as follows (quote_line_item is using single table inheritance): class Quote < ActiveRecord::Base has_many :quote_line_items end class LineItem < ActiveRecord::Base end class
2006 Apr 12
0
class attributes and thread safety
Are class attributes thread safe? For instance, the userstamp plugin creates a User.current_user attribute and then it aliases the ActiveRecard create and update methods to write created_by and updated_by attributes using the value of User.current_user. For some reason I can imagine a case where multiple users are logged in at the same time and saving objects, and the value of
2006 Apr 18
1
''wrong number of arguments'' for text_field?
This is probably something very simple but I can''t seem to figure out why I keep getting the ''wrong number of arguments (1 for 2)'' error with the following code when I try to create a new record. If anyone can see what is going wrong here please help! new.rhtml ------------------------------------------------- ... <%= start_form_tag :action =>
2007 Jul 30
0
Rails/MSSQL error
Hi, I have been encountering this error when I try to save text with japanese characters: DBI::DatabaseError: Execute OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server Line 1: Incorrect syntax near ''20070730''. HRESULT error code:0x80020009 Exception occurred.: INSERT INTO categories ([category_name], [updated_at], [created_by],
2007 Jan 03
2
Rails and bb forum integration
Hi, I''m new to Rails. Have read the Agile book. Working on new app, its going well. Now, I am at a crossroads. I need to choose a bbs for my site The significance for rails development is that I want to have single sign on between both my Rails app and my forum. I was just about to work on integrating the Rails SaltedLoginGenerator into my rails app when I read this post
2006 Mar 26
5
How to write manage created_on and created_by via mixin?
Hi! Definite newbie here - I''m working through this like-hate relationship with Ruby and Rails right now... sometimes things work really well (like blobs seem to rock) but other times, I dunno! :-) Anyway, I''d like put in create and update user timestamps on all my primary domain tables and allow them to be updated automatically by ActiveRecord. Coming from Hibernate, I just
2005 Aug 09
3
Adding created_by and updated_by trouble
Hi everyone. This is a real noob question that I''m hoping someone out there can help me with. I have followed the tutorial How to Ad created_by and updated_b<http://wiki.rubyonrails.com/rails/show/Howto%20Add%20created_by%20and%20updated_by>y and it works ok for retrieving the data. I''m using the Login_Generator. I cannot get it to work on create or update. I think
2008 May 29
2
Resource routing error with the route equipment/new
I''m having an issue with resource routing after running a "ruby script/generate scaffold equipment" command. I did not make any changes to the equipment model/controller/views after running this. The full command I ran (all one line) ... ruby script/generate scaffold equipment name:string description:text contact:text keywords:string created_at:datetime created_by:integer
2009 Jul 22
0
[LLVMdev] llvm-ld with -O params?
I'm also running into an issue with llc. Alchemy is trying to use -march avm2 and other avm2 options, but: llc: for the -march option: : Cannot find option named 'avm2'! llc: Unknown command line argument '-avm2-use-memuser'. Try: 'llc --help' llc: Unknown command line argument '-avm2-package-name=cmodule'. Try: 'llc --help' Was avm2 support dropped?
2009 Jul 22
2
[LLVMdev] llvm-ld with -O params?
On 2009-07-22 22:14, Simmons, Aaron wrote: > > I’m also running into an issue with llc. Alchemy is trying to use > –march avm2 and other avm2 options, but: > > llc: for the -march option: : Cannot find option named 'avm2'! > > llc: Unknown command line argument '-avm2-use-memuser'. Try: 'llc > --help' > > llc: Unknown command line argument