[Rails-core] Feature Request - Method to differentiate between a NullRelation and Actual Relation ?

2014-01-06 Thread Shadab Ahmed
Hey, I am passing a relation to a method. When the relation has been called with the *none *method, I want to do something else than usual flow. This is what I have to detect the NullRelation: User.where(id: 1).extending_values.include?(ActiveRecord::NullRelation)= false User.where(id:

[Rails-core] Re: Feature Request - Method to differentiate between a NullRelation and Actual Relation ?

2014-01-06 Thread Gabriel Sobrinho
That's the only way right now. Although, seems wrong to me check if a relation is a null relation, that's the point of null objects, you should not know that's a null object at all (may be necessary in your case but seems wrong to me). What you can do is something like `relation.empty?' which

[Rails-core] Windows users and `render file: 'path_to_file'`

2014-01-06 Thread Yaw Boakye
Unlike developers on *nix machines, Windows users have to be explicit about rendering file. render can't figure it out because it tries to find ?/ in it's first argument if it's a string or symbol. '/' is the *nix file separator. Windows uses '\'. Ruby's File::SEPARATOR, since 1.9.x knows the

[Rails-core] Re: Feature Request - Method to differentiate between a NullRelation and Actual Relation ?

2014-01-06 Thread Yves Senn
Hey, I agree with Gabriel Sobrinho. This check goes against the point of having a NullRelation at all. Maybe you can provide more context about your use-case and why you need that check. On Monday, January 6, 2014 7:35:56 AM UTC+1, Shadab Ahmed wrote: Hey, I am passing a relation to a

Re: [Rails-core] Windows users and `render file: 'path_to_file'`

2014-01-06 Thread Steve Klabnik
Windows supports both, and so does Ruby: https://github.com/ruby/ruby/blob/trunk/file.c#L2751-L2756 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Core group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: [Rails-core] Idea for handling dirty active_record serialized columns

2014-01-06 Thread Matt Jones
On Jan 5, 2014, at 11:46 PM, Keenan Brock kee...@thebrocks.net wrote: Hello All, Currently, `serialized` columns get save to the database whether they are changed or not. [Github][1]. Since the serialized columns can be modified inline, `Dirty` is not used. This behavior introduces too

Re: [Rails-core] Windows users and `render file: 'path_to_file'`

2014-01-06 Thread Yaw Boakye
Then the guide on rendering needs an update. It's says it's mandatory to specify file when passing a file path argument to render. On Monday, January 6, 2014 7:30:13 PM UTC, Steve Klabnik wrote: Windows supports both, and so does Ruby: