Anyone ported this to Rails 2.1?

1 view
Skip to first unread message

Aditya

unread,
May 26, 2008, 10:25:30 AM5/26/08
to Lovd by Less
Hi Guys,

Any tips/pointers/experiences/notes on running lovdbyless in Rails
2.1?

Cheers,
Aditya

Steven A Bristol

unread,
May 26, 2008, 11:43:24 AM5/26/08
to lovdb...@googlegroups.com
I'm not even gonna try until the official release.

steven bristol

Aditya

unread,
May 26, 2008, 5:20:30 PM5/26/08
to Lovd by Less
Okay, I couldnt resist!

Some preliminary results --

1. Need to update will_paginate to mislav-will_paginate from github.
They recommend that we dont require the plugin anymore. But as of 26th
May 2008, there is a dependency issue with activesupport which
prevents it being used with LovdByLess on 2.1. The workaround is to
use mislav-will_paginate as a plugin.

2. Need to update the top RAILS_GEM_VERSION to 2.1 or 2.0.991 whatever
the case might be.

3. footnotes-edge has to be removed from the vendor/plugin directory
as well to make this work. There were errors that i have not yet
investigated.

4. Profile.featured doesnt quite work. When the count of featured
profile is 1, rand is 0 which evaluates to a real number between 0 and
1 and then SQL doesnt quite like. This is infact a problem in the
current trunk version of LovdByLess as well i think. My version is
ids = connection.select_all('select id from profiles where
is_active = true and about_me is not null')
find(ids[rand(ids.length)]["id"].to_i) unless ids.blank?

The rest seems just fine. All tests passed.

Cheers,
Aditya

On May 26, 8:43 pm, "Steven A Bristol" <st...@lesseverything.com>
wrote:

Steven A Bristol

unread,
May 27, 2008, 5:05:51 AM5/27/08
to lovdb...@googlegroups.com
On 5/26/08, Aditya <aditya...@gmail.com> wrote:

Okay, I couldnt resist!

Some preliminary results --

1. Need to update will_paginate to mislav-will_paginate from github.
They recommend that we dont require the plugin anymore. But as of 26th
May 2008, there is a dependency issue with activesupport which
prevents it being used with LovdByLess on 2.1. The workaround is to
use mislav-will_paginate as a plugin.

2. Need to update the top RAILS_GEM_VERSION to 2.1 or 2.0.991 whatever
the case might be.

3. footnotes-edge has to be removed from the vendor/plugin directory
as well to make this work. There were errors that i have not yet
investigated.

4. Profile.featured doesnt quite work. When the count of featured
profile is 1, rand is 0 which evaluates to a real number between 0 and
1 and then SQL doesnt quite like. This is infact a problem in the
current trunk version of LovdByLess as well i think. My version is
    ids = connection.select_all('select id from profiles where
is_active = true and about_me is not null')
    find(ids[rand(ids.length)]["id"].to_i) unless ids.blank?


Thanks very much for testing this out. Would you submit a patch for the broken rand thing?

steve

Sazima

unread,
Jul 15, 2008, 11:06:43 AM7/15/08
to Lovd by Less
Hey guys,

I liked this simpler fix better:

find(:first, find_options.merge(:offset => rand( count(find_options) -
1).floor))

Cheers, Sazima

On May 27, 6:05 am, "Steven A Bristol" <st...@lesseverything.com>
wrote:

Sazima

unread,
Jul 16, 2008, 1:11:27 PM7/16/08
to Lovd by Less
Also, you can let the "-1" out, since rand already produces a value
less than the number passed as argument...

find(:first, find_options.merge(:offset =>
rand(count(find_options)).floor))

Cheers, Sazima

Steven A Bristol

unread,
Jul 17, 2008, 12:06:14 AM7/17/08
to lovdb...@googlegroups.com
On Wed, Jul 16, 2008 at 1:11 PM, Sazima <rsa...@gmail.com> wrote:
>
> Also, you can let the "-1" out, since rand already produces a value
> less than the number passed as argument...
>
> find(:first, find_options.merge(:offset =>
> rand(count(find_options)).floor))
>
> Cheers, Sazima
>
> On Jul 15, 12:06 pm, Sazima <rsaz...@gmail.com> wrote:
>> Hey guys,
>>
>> I liked this simpler fix better:
>>
>> find(:first, find_options.merge(:offset => rand( count(find_options) -
>> 1).floor))
>>

Does this work cross database? Is it broken now? Wanna give me a patch?


steve

Sazima

unread,
Jul 17, 2008, 10:51:11 AM7/17/08
to Lovd by Less
Hi Steven,

I already submitted a ticket with more details and a patch:

http://lovdbyless.lighthouseapp.com/projects/9110-lovd-by-less/tickets/10

I'm not sure what happens in other DBs, but MySQL doesn't like the
LIMIT part of the generated SQL query: "LIMIT 0.969211788092315, 1 "

Also, the rand logic is broken due to the subtraction of 1 from the
count.

Cheers, Sazima

On Jul 17, 1:06 am, "Steven A Bristol" <st...@lesseverything.com>
wrote:

dovadi

unread,
Jul 17, 2008, 4:44:04 PM7/17/08
to Lovd by Less
You need to update the expection notifier for Rails 2.1.0 as well.
Also I renamed the migration filenames, so they ar more in line with
the new convention of rails 2.1 (Timestamps in filename instead of
incremental numbering)

Frank Oxener

On Jul 17, 4:51 pm, Sazima <rsaz...@gmail.com> wrote:
> Hi Steven,
>
> I already submitted a ticket with more details and a patch:
>
> http://lovdbyless.lighthouseapp.com/projects/9110-lovd-by-less/ticket...

Steven A Bristol

unread,
Jul 21, 2008, 10:07:27 AM7/21/08
to lovdb...@googlegroups.com
On Thu, Jul 17, 2008 at 4:44 PM, dovadi <frank....@gmail.com> wrote:
>
> You need to update the expection notifier for Rails 2.1.0 as well.
> Also I renamed the migration filenames, so they ar more in line with
> the new convention of rails 2.1 (Timestamps in filename instead of
> incremental numbering)
>
> Frank Oxener
>

Can you submit a pull request with the updated notifier? I thought I
had done that already, but if not it needs to be done.

I'm not much interested in renaming the migrations.


steve

dovadi

unread,
Jul 22, 2008, 9:16:13 AM7/22/08
to Lovd by Less
You're right, I see you did it on the 1st of July.

Frank

On Jul 21, 4:07 pm, "Steven A Bristol" <st...@lesseverything.com>
wrote:
Reply all
Reply to author
Forward
0 new messages