Re: [Rails-core] Re: Extract fixtures to a separate gem for Rails 4

2012-07-05 Thread Neeraj Singh
Does anyone know of a gem which uses fixtures for testing? I looked at devise, arel etc but they do not use fixtures. Just trying to learn proper usage of fixtures. Of course Rails itself uses fixtures a lot but I am looking for other simpler gems. Thanks - Neeraj On Thursday, July 5, 2012

[Rails-core] Creating non standard primary key a confusing and does not work with primary key of type 'string'

2010-07-08 Thread Neeraj Singh
Case 1: create_table :users, :id = false, :primary_key = :user_id do |t| t.integer :user_id t.string :name t.timestamps end Above migration produces following sql: CREATE TABLE users (user_id integer, name varchar(255), created_at datetime, updated_at datetime) Exactly same sql would be

[Rails-core] Re: Creating non standard primary key a confusing and does not work with primary key of type 'string'

2010-07-08 Thread Neeraj Singh
is only a connivence for naming and auto incrementing integer column per adapter.  - Ken On Jul 8, 2010, at 10:02 AM, Neeraj Singh wrote: Case 1: create_table :users, :id = false, :primary_key = :user_id do |t|  t.integer :user_id  t.string :name  t.timestamps end Above

[Rails-core] Re: Creating non standard primary key a confusing and does not work with primary key of type 'string'

2010-07-08 Thread Neeraj Singh
to accommodate your edge case. Either way the schema statements will allow you to do all you want for the create table block.  - Ken On Jul 8, 2010, at 1:10 PM, Neeraj Singh wrote: Hi Ken, My intent is to fix the code. However before that I want to verify that I am on the right path

[Rails-core] Re: nested includes in AR and to_json / to_xml

2010-06-25 Thread Neeraj Singh
`.`user_id` WHERE (tasks.id is not null) I think the problem is, that the single sql query returns 3 rows for task2 (as described in my first post), since Rails edge the to_json/ to_xml return these 3 rows (and each row includes 3 users). On 25 Jun., 05:56, Neeraj Singh neerajdotn...@gmail.com

[Rails-core] Re: nested includes in AR and to_json / to_xml

2010-06-25 Thread Neeraj Singh
for task2 (as described in my first post), since Rails edge the to_json/ to_xml return these 3 rows (and each row includes 3 users). On 25 Jun., 05:56, Neeraj Singh neerajdotn...@gmail.com wrote: Hi David, This is what I found with rails edge. puts Project.find(2).to_xml(:include

[Rails-core] Re: nested includes in AR and to_json / to_xml

2010-06-24 Thread Neeraj Singh
Hi David, This is what I found with rails edge. puts Project.find(2).to_xml(:include = {:tasks = {:include = :users}}) project namepr2/name created-at type=datetime2010-06-25T03:50:57Z/created-at updated-at type=datetime2010-06-25T03:50:57Z/updated-at id type=integer2/id tasks

[Rails-core] Re: Default JavaScript library

2010-05-27 Thread Neeraj Singh
This is that api I propose. If it is agreed upon by core team then a patch can easily be created. # create a demo app with prototype javascript # in this way current behavior is not changed rails init demo # create a demo app with latest stable jquery # http://github.com/rails/jquery-ujs should

[Rails-core] select method on ActiveRecord::Relation brakes enumeration

2010-05-13 Thread Neeraj Singh
class Brake scope :good, where(:quality = 'good') end Brake.all.select :nil? #= works fine Brake.good.select :nil? #= FAILS Last statement fails because Brake.good.select is returning ActiveRecord::Relation and not an array. I have posted a detailed discussion on ticket #4589 .

[Rails-core] Re: In development mode not all types are included in the query related to type

2010-05-12 Thread Neeraj Singh
The sql that I posted came out after testing the exact case provided by the author of the ticket. While composing this email I did not layout the full hierarchy. @Colin. It is definitely due to class loading. If in development I load Agent then query will include Agent too. script/console Agent

[Rails-core] Re: In development mode not all types are included in the query related to type

2010-05-12 Thread Neeraj Singh
Since you have deleted all of the original post and my comments the above now makes no sense.  No-one reading this will know what your problem is without going back to the previous mail, which is something one should not normally be forced to do. Extremely sorry about that. I have created a

[Rails-core] Re: In development mode not all types are included in the query related to type

2010-05-12 Thread Neeraj Singh
User.find_by_name 'agent' generates a sql that does not use Agent or SuperAgent even if they are loaded. However the behavior of Agent.find_by_name 'agent' is different if SuperAgent is loaded. @Colin: SuperAgent should be a subclass of Agent. I have updated the gist with this info. @Mislav:

[Rails-core] Re: In development mode not all types are included in the query related to type

2010-05-12 Thread Neeraj Singh
Thanks everyone for the input. I understand what's going on now. I will mark ticket #4516 as invalid. On May 12, 10:51 am, Xavier Noria f...@hashref.com wrote: On Wed, May 12, 2010 at 4:36 PM, Mislav Marohnić mislav.maroh...@gmail.com wrote: When you're querying a parent that doesn't have

[Rails-core] rails is removing constants which it is not able to restore properly in development mode

2010-05-12 Thread Neeraj Singh
I have updated ticket https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4149-strange-require-behavior-in-development-environment#ticket-4149-10 with my thoughts. Would appreciate any comments on how to go about resolving the issue in dependencies.rb . -- You received this

[Rails-core] In development mode not all types are included in the query related to type

2010-05-11 Thread Neeraj Singh
class User end class Agent User end script/console production User.find_by_name 'john' SELECT people.* FROM people WHERE (((people.type = 'User' OR people.type = 'Manager') OR people.type = 'Agent')) AND (people.name = 'agent') LIMIT 1 In development mode. script/console User.find_by_name

[Rails-core] inverse_of not working as documented

2010-05-09 Thread Neeraj Singh
Please take a look at this gist http://gist.github.com/395267 . It seems inverse_of is not working as I expect it to. Or am I missing something here? Thanks -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Core group. To post to this group, send

[Rails-core] Re: inverse_of not working as documented

2010-05-09 Thread Neeraj Singh
Thanks Michael for the clarification. Any thoughts on should Trap.first.dungeon be blowing up? - Neeraj On May 9, 6:30 pm, Michael Koziarski mich...@koziarski.com wrote: It seems inverse_of is not working as I expect it to. Or am I missing something here? inverse_of isn't an identity map,