What is this view syntax? Old beast forum code

Hey folks

A long time ago, before i started working at this company, we used a
Beast forum. The beast code (models, controllers and views) were all
just lumped in with our app code, but when we moved to a new version
(about a year and a half ago) the forum section of our site was closed
off (simply by not linking to it anywhere).

I’ve been tasked with resurrecting it, and the first problem i’m seeing
is code like this in the views:

<%= '{count} topic(s)'[(count=Topic.count)==1 ? :topic_count :

:topics_count, number_with_delimiter(count)] %>,

or

<%= submit_tag ‘Save Forum’[:save_forum], :or =>
link_to(‘Cancel’[:cancel], forums_path) %>

My first thought was “wtf is that?”, and it’s that question that i put
to you, dear readers.

max

On Sep 30, 2009, at 6:30 AM, Max W. wrote:

<%= ‘{count} topic(s)’[(count=Topic.count)==1 ? :topic_count :
:topics_count, number_with_delimiter(count)] %>,

or

<%= submit_tag ‘Save Forum’[:save_forum], :or =>
link_to(‘Cancel’[:cancel], forums_path) %>

My first thought was “wtf is that?”, and it’s that question that i put
to you, dear readers.

Looks like a stab at L10N. I bet “string”[:symbol] is a way to have
‘reasonable’ strings embedded in the code, but still look 'em up in a
translation table.

~ j.

John B. wrote:

On Sep 30, 2009, at 6:30 AM, Max W. wrote:

<%= ‘{count} topic(s)’[(count=Topic.count)==1 ? :topic_count :
:topics_count, number_with_delimiter(count)] %>,

or

<%= submit_tag ‘Save Forum’[:save_forum], :or =>
link_to(‘Cancel’[:cancel], forums_path) %>

My first thought was “wtf is that?”, and it’s that question that i put
to you, dear readers.

Looks like a stab at L10N. I bet “string”[:symbol] is a way to have
‘reasonable’ strings embedded in the code, but still look 'em up in a
translation table.

~ j.
hmm, yeah, you may be on to something there, John.

hahahaha no way, just googled “beast forum localization” -
hahahahahahaha

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs