librelist archives

« back to archive

Date as_json and Rails 3

Date as_json and Rails 3

From:
Victor Augusto de Campos
Date:
2011-01-05 @ 01:21
Hey all,
I'm beginning to write some code using CouchDB over RoR, I'm already
familiar with CouchDB working over PHP and Java so there's no problem
in thinking as CouchDB and I liked very much the approach of diverging
from ActiveRecord model :P

As the README for CouchPotato says to use a config.gem line I moved it
to the equivalent Bundler line, but I noticed that the given case to
test for Date.today.as_json is returning the 2011-01-04 format instead
of the expected 2011/01/04 and so I moved the gem line in Gemfile down
to the bottom but with no effect.

Anyone has experienced that? Any thoughts for a fix?

Thanks for the attention,
Victor
---
@victorcampos on twitter

Re: [couchpotato] Date as_json and Rails 3

From:
Alexander Lang
Date:
2011-01-05 @ 09:52
hi victor,

what rails version are you using? i have a rails3 app with couch_potato as
the last entry in my Gemfile and it works. what other gems have you 
required? maybe you can show me your gemfile.

cheers,
alex

On Jan 5, 2011, at 2:21 , Victor Augusto de Campos wrote:

> Hey all,
> I'm beginning to write some code using CouchDB over RoR, I'm already
> familiar with CouchDB working over PHP and Java so there's no problem
> in thinking as CouchDB and I liked very much the approach of diverging
> from ActiveRecord model :P
> 
> As the README for CouchPotato says to use a config.gem line I moved it
> to the equivalent Bundler line, but I noticed that the given case to
> test for Date.today.as_json is returning the 2011-01-04 format instead
> of the expected 2011/01/04 and so I moved the gem line in Gemfile down
> to the bottom but with no effect.
> 
> Anyone has experienced that? Any thoughts for a fix?
> 
> Thanks for the attention,
> Victor
> ---
> @victorcampos on twitter

---

software development: http://upstre.am
coworking space: http://co-up.de
coworking space management: http://cobot.me

Re: [couchpotato] Date as_json and Rails 3

From:
Victor Augusto de Campos
Date:
2011-01-05 @ 16:51
Hi Alex,
Thanks for the quick reply :D

I'm using Rails 3.0.1 and with pretty straightforward gems, from the
default I just added couch_potato and the source
'http://gemcutter.org' to it, I'm pasting it below:

source 'http://rubygems.org'
source 'http://gemcutter.org'

gem 'rails', '3.0.1'

gem 'sqlite3-ruby', :require => 'sqlite3'

gem 'couch_potato', '0.4.0'

As you can see, couch_potato is already the last gem in the Gemfile
and yet when I run Date.today.as_json it gives me the "2011-01-04"
format :/

Thanks for the support,
Best regards,

Victor
---
@victorcampos on twitter



On Wed, Jan 5, 2011 at 7:52 AM, Alexander Lang <_@alex.io> wrote:
> hi victor,
>
> what rails version are you using? i have a rails3 app with couch_potato 
as the last entry in my Gemfile and it works. what other gems have you 
required? maybe you can show me your gemfile.
>
> cheers,
> alex
>
> On Jan 5, 2011, at 2:21 , Victor Augusto de Campos wrote:
>
>> Hey all,
>> I'm beginning to write some code using CouchDB over RoR, I'm already
>> familiar with CouchDB working over PHP and Java so there's no problem
>> in thinking as CouchDB and I liked very much the approach of diverging
>> from ActiveRecord model :P
>>
>> As the README for CouchPotato says to use a config.gem line I moved it
>> to the equivalent Bundler line, but I noticed that the given case to
>> test for Date.today.as_json is returning the 2011-01-04 format instead
>> of the expected 2011/01/04 and so I moved the gem line in Gemfile down
>> to the bottom but with no effect.
>>
>> Anyone has experienced that? Any thoughts for a fix?
>>
>> Thanks for the attention,
>> Victor
>> ---
>> @victorcampos on twitter
>
> ---
>
> software development: http://upstre.am
> coworking space: http://co-up.de
> coworking space management: http://cobot.me
>
>

Re: [couchpotato] Date as_json and Rails 3

From:
Alexander Lang
Date:
2011-01-05 @ 18:39
it seems that activerecord is the problem. if you comment out rails in 
your gemfile and replace it with:

    gem 'railties'
    gem 'actionpack'
    gem 'actionmailer'
    gem 'activemodel'

then it works.

On Jan 5, 2011, at 17:51 , Victor Augusto de Campos wrote:

> Hi Alex,
> Thanks for the quick reply :D
> 
> I'm using Rails 3.0.1 and with pretty straightforward gems, from the
> default I just added couch_potato and the source
> 'http://gemcutter.org' to it, I'm pasting it below:
> 
> source 'http://rubygems.org'
> source 'http://gemcutter.org'
> 
> gem 'rails', '3.0.1'
> 
> gem 'sqlite3-ruby', :require => 'sqlite3'
> 
> gem 'couch_potato', '0.4.0'
> 
> As you can see, couch_potato is already the last gem in the Gemfile
> and yet when I run Date.today.as_json it gives me the "2011-01-04"
> format :/
> 
> Thanks for the support,
> Best regards,
> 
> Victor
> ---
> @victorcampos on twitter
> 
> 
> 
> On Wed, Jan 5, 2011 at 7:52 AM, Alexander Lang <_@alex.io> wrote:
>> hi victor,
>> 
>> what rails version are you using? i have a rails3 app with couch_potato
as the last entry in my Gemfile and it works. what other gems have you 
required? maybe you can show me your gemfile.
>> 
>> cheers,
>> alex
>> 
>> On Jan 5, 2011, at 2:21 , Victor Augusto de Campos wrote:
>> 
>>> Hey all,
>>> I'm beginning to write some code using CouchDB over RoR, I'm already
>>> familiar with CouchDB working over PHP and Java so there's no problem
>>> in thinking as CouchDB and I liked very much the approach of diverging
>>> from ActiveRecord model :P
>>> 
>>> As the README for CouchPotato says to use a config.gem line I moved it
>>> to the equivalent Bundler line, but I noticed that the given case to
>>> test for Date.today.as_json is returning the 2011-01-04 format instead
>>> of the expected 2011/01/04 and so I moved the gem line in Gemfile down
>>> to the bottom but with no effect.
>>> 
>>> Anyone has experienced that? Any thoughts for a fix?
>>> 
>>> Thanks for the attention,
>>> Victor
>>> ---
>>> @victorcampos on twitter
>> 
>> ---
>> 
>> software development: http://upstre.am
>> coworking space: http://co-up.de
>> coworking space management: http://cobot.me
>> 
>> 

---

software development: http://upstre.am
coworking space: http://co-up.de
coworking space management: http://cobot.me

Re: [couchpotato] Date as_json and Rails 3

From:
Victor Augusto de Campos
Date:
2011-01-07 @ 09:29
Alex,
I was studying a bit more and found that the best practice for JSON
Dates is using the ActiveRecord approach using ISO 8601, Rails 2 used
to be in Y/m/d format but in Rails 3 it migrated to comply with ISO
8601.

So I'm thinking to add a check or a config for choosing either Y/m/d
for legacy applications or Y-m-d format complying with Rails 3,
personally I feel much better using ISO 8601.

Is there anything I missed for the Date and Time classes in as_json methods?

Thanks for all again :D
Best Regards,

Victor
---
@victorcampos on twitter



On Wed, Jan 5, 2011 at 4:39 PM, Alexander Lang <_@alex.io> wrote:
> it seems that activerecord is the problem. if you comment out rails in 
your gemfile and replace it with:
>
>    gem 'railties'
>    gem 'actionpack'
>    gem 'actionmailer'
>    gem 'activemodel'
>
> then it works.
>
> On Jan 5, 2011, at 17:51 , Victor Augusto de Campos wrote:
>
>> Hi Alex,
>> Thanks for the quick reply :D
>>
>> I'm using Rails 3.0.1 and with pretty straightforward gems, from the
>> default I just added couch_potato and the source
>> 'http://gemcutter.org' to it, I'm pasting it below:
>>
>> source 'http://rubygems.org'
>> source 'http://gemcutter.org'
>>
>> gem 'rails', '3.0.1'
>>
>> gem 'sqlite3-ruby', :require => 'sqlite3'
>>
>> gem 'couch_potato', '0.4.0'
>>
>> As you can see, couch_potato is already the last gem in the Gemfile
>> and yet when I run Date.today.as_json it gives me the "2011-01-04"
>> format :/
>>
>> Thanks for the support,
>> Best regards,
>>
>> Victor
>> ---
>> @victorcampos on twitter
>>
>>
>>
>> On Wed, Jan 5, 2011 at 7:52 AM, Alexander Lang <_@alex.io> wrote:
>>> hi victor,
>>>
>>> what rails version are you using? i have a rails3 app with 
couch_potato as the last entry in my Gemfile and it works. what other gems
have you required? maybe you can show me your gemfile.
>>>
>>> cheers,
>>> alex
>>>
>>> On Jan 5, 2011, at 2:21 , Victor Augusto de Campos wrote:
>>>
>>>> Hey all,
>>>> I'm beginning to write some code using CouchDB over RoR, I'm already
>>>> familiar with CouchDB working over PHP and Java so there's no problem
>>>> in thinking as CouchDB and I liked very much the approach of diverging
>>>> from ActiveRecord model :P
>>>>
>>>> As the README for CouchPotato says to use a config.gem line I moved it
>>>> to the equivalent Bundler line, but I noticed that the given case to
>>>> test for Date.today.as_json is returning the 2011-01-04 format instead
>>>> of the expected 2011/01/04 and so I moved the gem line in Gemfile down
>>>> to the bottom but with no effect.
>>>>
>>>> Anyone has experienced that? Any thoughts for a fix?
>>>>
>>>> Thanks for the attention,
>>>> Victor
>>>> ---
>>>> @victorcampos on twitter
>>>
>>> ---
>>>
>>> software development: http://upstre.am
>>> coworking space: http://co-up.de
>>> coworking space management: http://cobot.me
>>>
>>>
>
> ---
>
> software development: http://upstre.am
> coworking space: http://co-up.de
> coworking space management: http://cobot.me
>
>

Re: [couchpotato] Date as_json and Rails 3

From:
Alexander Lang
Date:
2011-01-07 @ 09:49
ok if that's the case then it makes sense. the only thing that's important
is that couch can still sort correctly when you use the time as a key, 
i.e. it must be converted to UTC and ordering alphabeticallly must yield 
the same results as ordering by time.

On Jan 7, 2011, at 10:29 , Victor Augusto de Campos wrote:

> Alex,
> I was studying a bit more and found that the best practice for JSON
> Dates is using the ActiveRecord approach using ISO 8601, Rails 2 used
> to be in Y/m/d format but in Rails 3 it migrated to comply with ISO
> 8601.
> 
> So I'm thinking to add a check or a config for choosing either Y/m/d
> for legacy applications or Y-m-d format complying with Rails 3,
> personally I feel much better using ISO 8601.
> 
> Is there anything I missed for the Date and Time classes in as_json methods?
> 
> Thanks for all again :D
> Best Regards,
> 
> Victor
> ---
> @victorcampos on twitter
> 
> 
> 
> On Wed, Jan 5, 2011 at 4:39 PM, Alexander Lang <_@alex.io> wrote:
>> it seems that activerecord is the problem. if you comment out rails in 
your gemfile and replace it with:
>> 
>>    gem 'railties'
>>    gem 'actionpack'
>>    gem 'actionmailer'
>>    gem 'activemodel'
>> 
>> then it works.
>> 
>> On Jan 5, 2011, at 17:51 , Victor Augusto de Campos wrote:
>> 
>>> Hi Alex,
>>> Thanks for the quick reply :D
>>> 
>>> I'm using Rails 3.0.1 and with pretty straightforward gems, from the
>>> default I just added couch_potato and the source
>>> 'http://gemcutter.org' to it, I'm pasting it below:
>>> 
>>> source 'http://rubygems.org'
>>> source 'http://gemcutter.org'
>>> 
>>> gem 'rails', '3.0.1'
>>> 
>>> gem 'sqlite3-ruby', :require => 'sqlite3'
>>> 
>>> gem 'couch_potato', '0.4.0'
>>> 
>>> As you can see, couch_potato is already the last gem in the Gemfile
>>> and yet when I run Date.today.as_json it gives me the "2011-01-04"
>>> format :/
>>> 
>>> Thanks for the support,
>>> Best regards,
>>> 
>>> Victor
>>> ---
>>> @victorcampos on twitter
>>> 
>>> 
>>> 
>>> On Wed, Jan 5, 2011 at 7:52 AM, Alexander Lang <_@alex.io> wrote:
>>>> hi victor,
>>>> 
>>>> what rails version are you using? i have a rails3 app with 
couch_potato as the last entry in my Gemfile and it works. what other gems
have you required? maybe you can show me your gemfile.
>>>> 
>>>> cheers,
>>>> alex
>>>> 
>>>> On Jan 5, 2011, at 2:21 , Victor Augusto de Campos wrote:
>>>> 
>>>>> Hey all,
>>>>> I'm beginning to write some code using CouchDB over RoR, I'm already
>>>>> familiar with CouchDB working over PHP and Java so there's no problem
>>>>> in thinking as CouchDB and I liked very much the approach of diverging
>>>>> from ActiveRecord model :P
>>>>> 
>>>>> As the README for CouchPotato says to use a config.gem line I moved it
>>>>> to the equivalent Bundler line, but I noticed that the given case to
>>>>> test for Date.today.as_json is returning the 2011-01-04 format instead
>>>>> of the expected 2011/01/04 and so I moved the gem line in Gemfile down
>>>>> to the bottom but with no effect.
>>>>> 
>>>>> Anyone has experienced that? Any thoughts for a fix?
>>>>> 
>>>>> Thanks for the attention,
>>>>> Victor
>>>>> ---
>>>>> @victorcampos on twitter
>>>> 
>>>> ---
>>>> 
>>>> software development: http://upstre.am
>>>> coworking space: http://co-up.de
>>>> coworking space management: http://cobot.me
>>>> 
>>>> 
>> 
>> ---
>> 
>> software development: http://upstre.am
>> coworking space: http://co-up.de
>> coworking space management: http://cobot.me
>> 
>> 

---

software development: http://upstre.am
coworking space: http://co-up.de
coworking space management: http://cobot.me

Re: [couchpotato] Date as_json and Rails 3

From:
Victor Augusto de Campos
Date:
2011-01-05 @ 18:45
Uhmm, that would hurt me since I'm using ActiveRecord for my Users
model... I'll see if I can patch it in some way that both gems work
side-by-side.

If I patch it successfully I send you some notes/code regarding it, ok?

Thanks for all, Alex, great work into this gem :D

Best Regards,
Victor
---
@victorcampos on twitter



On Wed, Jan 5, 2011 at 4:39 PM, Alexander Lang <_@alex.io> wrote:
> it seems that activerecord is the problem. if you comment out rails in 
your gemfile and replace it with:
>
>    gem 'railties'
>    gem 'actionpack'
>    gem 'actionmailer'
>    gem 'activemodel'
>
> then it works.
>
> On Jan 5, 2011, at 17:51 , Victor Augusto de Campos wrote:
>
>> Hi Alex,
>> Thanks for the quick reply :D
>>
>> I'm using Rails 3.0.1 and with pretty straightforward gems, from the
>> default I just added couch_potato and the source
>> 'http://gemcutter.org' to it, I'm pasting it below:
>>
>> source 'http://rubygems.org'
>> source 'http://gemcutter.org'
>>
>> gem 'rails', '3.0.1'
>>
>> gem 'sqlite3-ruby', :require => 'sqlite3'
>>
>> gem 'couch_potato', '0.4.0'
>>
>> As you can see, couch_potato is already the last gem in the Gemfile
>> and yet when I run Date.today.as_json it gives me the "2011-01-04"
>> format :/
>>
>> Thanks for the support,
>> Best regards,
>>
>> Victor
>> ---
>> @victorcampos on twitter
>>
>>
>>
>> On Wed, Jan 5, 2011 at 7:52 AM, Alexander Lang <_@alex.io> wrote:
>>> hi victor,
>>>
>>> what rails version are you using? i have a rails3 app with 
couch_potato as the last entry in my Gemfile and it works. what other gems
have you required? maybe you can show me your gemfile.
>>>
>>> cheers,
>>> alex
>>>
>>> On Jan 5, 2011, at 2:21 , Victor Augusto de Campos wrote:
>>>
>>>> Hey all,
>>>> I'm beginning to write some code using CouchDB over RoR, I'm already
>>>> familiar with CouchDB working over PHP and Java so there's no problem
>>>> in thinking as CouchDB and I liked very much the approach of diverging
>>>> from ActiveRecord model :P
>>>>
>>>> As the README for CouchPotato says to use a config.gem line I moved it
>>>> to the equivalent Bundler line, but I noticed that the given case to
>>>> test for Date.today.as_json is returning the 2011-01-04 format instead
>>>> of the expected 2011/01/04 and so I moved the gem line in Gemfile down
>>>> to the bottom but with no effect.
>>>>
>>>> Anyone has experienced that? Any thoughts for a fix?
>>>>
>>>> Thanks for the attention,
>>>> Victor
>>>> ---
>>>> @victorcampos on twitter
>>>
>>> ---
>>>
>>> software development: http://upstre.am
>>> coworking space: http://co-up.de
>>> coworking space management: http://cobot.me
>>>
>>>
>
> ---
>
> software development: http://upstre.am
> coworking space: http://co-up.de
> coworking space management: http://cobot.me
>
>