No. of comments


#1

Hello
This is possibly a very simple question… I have posts that have
comments. All fine… I wanted to add a link to my display page (the
one that shows x posts) for comments… but I wanted to show if it
has 3 comments, No comments and so on. Can someone point me in the
right direction. The comments table contains the post_id. So I need a
method in my post.rb model:
def count_comments
@mycount = ?
end
Any pointers appreciated…
Thanks


#2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Nov 9, 2005, at 3:48 PM, eoghan wrote:

Any pointers appreciated…
post.comments.size

It’ll issue a count(*) from comments where post_id=? if comments
isn’t already loaded.

Also see the :counter_cache option for belongs_to.

jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDcox9AQHALep9HFYRAigtAKCA9ewkj7AJjOXqLMHNx7pv1XJZ9ACfa/N4
fstzufV1UnjhG0YlgWM3/B0=
=c3i0
-----END PGP SIGNATURE-----


#3

Hi,

I have recently started looking at RoR and it looks
very promising for sure… In fact, I would like to
start using it right away and implement one of my
sites with RoR, which needs to be phased into
production in about 1-2 months. It will start as a
small site, hence will use shared hosting in the
beginning, but then probably will be moved to
VPS/dedicated after couple of months…

However, I am a bit worried about how to host the
site… I have been trying to find a reliable “shared”
hosting solution for RoR, but did not have any luck.
Right now, as far as I can see, the main hosting
companies are: Site5, DreamHost and TextDrive.

TextDrive seems to be nice for development purposes,
but looking at their uptime records, it is not
possible to use it for production.

Both, Site5 & DreamHost look like they are still
experimenting with it, hence not suitable for
production purposes.

So, in summary, can you guys please share your
experience regarding this?

Thanks…


Yahoo! Mail - PC Magazine Editors’ Choice 2005
http://mail.yahoo.com


#4

On 9 Nov 2005, at 23:55, Jeremy K. wrote:

end
Any pointers appreciated…

post.comments.size

It’ll issue a count(*) from comments where post_id=? if comments
isn’t already loaded.

Also see the :counter_cache option for belongs_to.

Ah, thanks Jeremy… it was that simple :slight_smile:


#5

Hi Cabbar,

Site5’s RoR setup is pretty solid at the moment - in fact, we (at
Site5 - I’m a senior engineer there) are about to release a major
customer-facing production system based on Rails shortly (called
Flashback, currently being beta tested by a select group of our
customers - shameless teaser plug here:
http://karmiccoding.com/articles/2005/10/24/flashback-and-the-discovery-process),
which we would not be doing if we had any stability issues.

Hope that helps!

David F.


#6

My host (SonataWeb) is currently supporting it, but I don’t have much to
go
by to give you any information on how well. I’ll start putting some
stuff
up there to experiment with in the near future.

Jake


#7

On 10/11/2005, at 11:05 AM, Cabbar D. wrote:

TextDrive seems to be nice for development purposes,
but looking at their uptime records, it is not
possible to use it for production.

Actually, we (TextDrive) are not fine for development purposes, and
that’s the problem. Rails sites in development mode, or being
restarted every 15 seconds by developers looking for somewhere to
develop or stage their app instead of HOST it are absolutely killing
our servers. Add in a whole bunch of Lighty installs running 4, 10
or even 40 FCGIs instead of 2, and any host with our ratio of Rails
applications would have a problem.

We’re not that far away (a month or so) from releasing RailsBase
(formerly RailsAppHosting).

Half of our development team have been working with Ben M. around
the clock for months and months – it’s a purpose built cluster of
servers specifically and exclusively for Rails with SCGI, Lighty, SVN
and a suite of tools that make developing, deploying, updating and
managing Rails apps a breeze.

I’m not hyping it, I’m just telling you what we’re doing.

Both, Site5 & DreamHost look like they are still
experimenting with it, hence not suitable for
production purposes.

Well, to the best of my knowledge, they’re both running mod_fastcgi
under Apache, and that simply won’t scale in a shared hosting
environment. If they haven’t realised that yet, they will soon.

Regards,

Justin F.

http://www.justinfrench.com
http://www.textdrive.com
http://www.strongspace.com


#8

We’re not that far away (a month or so) from releasing RailsBase
(formerly RailsAppHosting).

This is news. I thought you guys were going to launch in mid-October and
that launch was imminent any day. I really don’t know what I’m going to
do
about hosting based on these comments.

Steve


#9

Sounds like an awsome decision and an honest answer… Much better than
doing what every other business does by rushing to get something out the
door when it isnt ready, and then burn the customers after they have
their
money…

+1 props

–Ryan

----- Original Message -----
From: “Justin F.” removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
Sent: Wednesday, November 09, 2005 11:29 PM
Subject: Re: [Rails] RoR and Hosting


#10

On 10/11/2005, at 3:01 PM, Steve O. wrote:

This is news. I thought you guys were going to launch in mid-
October and that launch was imminent any day. I really don’t know
what I’m going to do about hosting based on these comments.

What can I say? The truth is we probably should have said nothing,
announced nothing, etc. But we did, and we were wrong. We changed
our minds on a few things, decided to make a lot changes to hardware
and plan specifications (ultimately making this a much better service
than it ever would have been back in September or October), and we
need more time to make sure it’s right.

Justin


#11

Justin,

Given that, you are probably one of the most
experienced people in terms of hosting rails apps, can
you please share your experience regarding rails on
lighthttpd (e.g. on VPS or dedicated)? Is it stable?
Do you see memory leaks/runaway threads|processes kind
of problems? Is it scalable? Basically, once again, do
you think you can host a production quality site with
that?

One more question regards to that, does it need a lot
of petting, meaning do you need to constantly monitor
it/apply patches/etc? These are unavoidable even for
relatively more stable technologies like servlet/php
of course, but is rails sustainable in that sense?

Thanks…

— Justin F. removed_email_address@domain.invalid wrote:

mode, or being
We’re not that far away (a month or so) from
deploying, updating and
Well, to the best of my knowledge, they’re both

http://lists.rubyonrails.org/mailman/listinfo/rails


Yahoo! Mail - PC Magazine Editors’ Choice 2005
http://mail.yahoo.com


#12

Hi David,

Will all due respect, your internal implementation of
an application does not reflect the overall quality of
RoR hosting on shared hosting environment, don’t you
think so?

And, my comment/question was geared more towards the
“shared hosting” environment… I was browsing through
site5 forums, and also read about Apache+FCGI
installations. And, what I can see at this point is
that, Apache+FCGI installation (for rails) has serious
problems in itself, such as memory leaks, scaling
issues, etc.

And, the only way to implement a solution is to start
with dedicated or VPS using light-httpd, it looks
like?

Please correct me if I am wrong.
Thanks

— David F. removed_email_address@domain.invalid wrote:

customers - shameless teaser plug here:

http://karmiccoding.com/articles/2005/10/24/flashback-and-the-discovery-process),

but looking at their uptime records, it is not

http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Yahoo! Mail - PC Magazine Editors’ Choice 2005
http://mail.yahoo.com


#13

Hi David,

Will all due respect, your internal implementation of
an application does not reflect the overall quality of
RoR hosting on shared hosting environment, don’t you
think so?

And, my comment/question was geared more to the
“shared hosting” environment… I was browsing through
site5 forums, and also read about Apache+FCGI
installations. And, what I can see at this point is
that, Apache+FCGI installation (for rails) has serious
problems in itself, such as memory leaks, scaling
issues, etc. And, there were some people complaining
on the forums about Site5 hosting as far as I can
remember.

And, the only way to implement a solution is to start
with dedicated or VPS using light-httpd, it looks
like?

Please correct me if I am wrong.
Thanks,

— David F. removed_email_address@domain.invalid wrote:

customers - shameless teaser plug here:

http://karmiccoding.com/articles/2005/10/24/flashback-and-the-discovery-process),

but looking at their uptime records, it is not

http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Start your day with Yahoo! - Make it your home page!


#14

Cabbar-

The best way to go IMHO is to get a small VPS and do it yourself.

Its the only way to really have reliable hosting for rails projects.
Textdrive is great for experiments but can’t yet be trusted for
reliable production sites. And none of the other hosts that support
raisl in a shared environment are any better if not worse.

I am using xen based VPS's from http://rimuhosting and they work

great. The fastest VPS systems I have ever used since the xen
virtualization stuf fis right in the linux kernel. I use one of the
$29 plans there and it runs two typo rails blogs and one other rails
app perfectly. Plus my own mail server and other services are nice to
have. And the benifits of not being affected by other users on a
server are invaluable when working with rails. The VPS or a dedicated
server is your best bet for production rails hosting.

Cheers-
-Ezra

On Nov 9, 2005, at 4:05 PM, Cabbar D. wrote:

Both, Site5 & DreamHost look like they are still


Yahoo! Mail - PC Magazine Editors’ Choice 2005
http://mail.yahoo.com


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
removed_email_address@domain.invalid
509-577-7732


#15

Hi Cabbar,

Site5 will be hosting Flashback (one installation per server, in fact)
on the same shared servers our customers use - we would absolutely
positively not be risking our level of service if we weren’t 100%
confident that it would not interfere with our customers’ hosting
environment - in fact, in our testing on some of our very low end
test machines, the application, with its Apache/FCGI setup, has barely
even made a mark on the server’s load statistics. And bear in mind
that this test machine was nowhere near the spec of our current
servers, in fact it is several generations older and significantly
slower.

It is true that FCGI is not an optimal solution, especially in the
scenarios that Justin has described, but Site5 is well placed in that
it can dynamically and transparently hot-swap highly-loaded sites onto
less-loaded servers during times of heavy load. I will, however,
disagree with you on that the only way to implement a reliable
solution is to use lighttpd and/or a VPS - Apache and FastCGI provide
perfectly acceptable performance for the majority of applications.

Personally, my preference leans towards Zed S.'s fantastic
SCGI/Rails implementation over FCGI, and this is something that Site5
is currently looking into providing as well.

Best regards,

-David F.


#16

I was venting a little when I expressed my disappointment at railsbase
not
being launched for a month or more. Justin’s response is exactly why I
am in
a quandry. It was a honest answer tempered with lots of knowledge of the
limitiations of rails in a shared hosting environoment. I’m afraid to go
anywhere else. That’s why I have been waiting for railsbase. Those guys
seem
to be the best for rails.

It seems a VPS solution could work as well. But I don’t know how to set
it
up. It seems a little itimidating. Do you need to have modest, even
some,
experience experience setting up and maintaining a server to run a VPS?
Because I have none.

I’m going to check out Ezra’s recommendation of rizuhosting, because
Ezra’s
been a big help on this board and has contributed a lot.

Steve


#17

On 11/10/05, Steve O. removed_email_address@domain.invalid wrote:

Because I have none.

This is news. I thought you guys were going to launch in mid-
Justin
http://lists.rubyonrails.org/mailman/listinfo/rails

I just moved a site from textdrive to dreamhost after customer freaked
when they saw textdrvie uptime stats after their site went down for
second time in three days…

Dreamhost seems pretty solid. In some respects. I think less rails
hosting is good, since then there is less change of shared server
getting whacked by a complex project/misconfigured app. But what
really tipped customer was comparing tech. support responsiveness.

Overall, I deeply regret getting involved in shared hosting. I realize
dreamhost is also shared hosting, but the customer already used them
for other sites and figured it was a better short-term solution. I
can’t say if it is since I don’t have enough data yet.

Nick

Nicholas Van W.


#18
  • On Nov 9 16:05, Cabbar D. (removed_email_address@domain.invalid) wrote:

It will start as a
small site, hence will use shared hosting in the
beginning, but then probably will be moved to
VPS/dedicated after couple of months…

I would highly recommend A Small Orange for both shared hosting and VPS.
I’ve been using them for months now and it’s very quick, they have
unbelievable support, and I haven’t had any downtime. They support
Rails
under FastCGI along with pretty much anything else you’d want, and even
under their (cheap) shared hosting you get basically unlimited
everything.

(If you don’t mind my referring you to them, here’s a link:)
http://www.asmallorange.com/services/hosting/?refer=halffull.org

Tom


#19

I’m about to host with:
http://sustainablemarketing.com/

Their main hosting machines are powered completely off of wind power :slight_smile:
(they have backup datacenters of course).

I’ll let you know how it goes !


#20

Hi,

On 11/10/05, Cabbar D. removed_email_address@domain.invalid wrote:

Given that, you are probably one of the most
experienced people in terms of hosting rails apps, can
you please share your experience regarding rails on
lighthttpd (e.g. on VPS or dedicated)? Is it stable?
Do you see memory leaks/runaway threads|processes kind
of problems? Is it scalable? Basically, once again, do
you think you can host a production quality site with
that?

We love lightty at TextDrive, but as with any kind of server app bad
code and bad decisions can make it go nuts.
Bad decisions includes running say, dedaleus, and respawing fcgi
dispatchers faster than they can shut down and so on.
Bad code, well, we all know how that can sneak in through the backdoor…
scale? if by scale you mean can serve request hella fast, then yes:
http://weblog.textdrive.com/article/26/benchmarking-lighttpd

Many big rails production apps run under lighttpd.

One more question regards to that, does it need a lot
of petting, meaning do you need to constantly monitor
it/apply patches/etc? These are unavoidable even for
relatively more stable technologies like servlet/php
of course, but is rails sustainable in that sense?

I see code as organic, if you’re aren’t petting and improving it, then
why did you write it in the first place? If you have a dog it’ll be
your best friend, but only if you take care of it.
But in general I don’t see Ruby has needing anymore petting than
anything else, but bugs will always occur regardless of language. That
said, yeah, Rails moves fast sometimes but thats a good thing, it’ll
give you an excuse to refactor your app every once in a while.

JS


http://johansorensen.com
http://theexciter.com