We want the constant, and we pass a symbol, so it goes:
params[:model] = :discussion
params[:model].to_s = 'discussion'
params[:model].to_s.humanize = 'Discussion'
params[:model].to_s.humanize.constantize = Discussion

(humanize replaces '-' with ' ' and capitalizes the first letter of a
series of words. Designed to go from parameterized input
'lets-go-to-the-park' to a group title or something ('Lets go to the park')


On Mon, Feb 10, 2014 at 10:53 AM, john irving <notifications@github.com>wrote:

> In app/controllers/translations_controller.rb:
>
> > @@ -0,0 +1,16 @@
> > +class TranslationsController < BaseController
> > +  skip_before_filter :authenticate_user!, only: :translate
> > +  before_filter :load_translation, only: :translate
> > +
> > +  def translate
> > +    render :template => "#{params[:model].to_s.downcase.pluralize}/#{params[:model].to_s.downcase}_translations"
> > +  end
> > +
> > +  def load_translation
> > +    model = params[:model].to_s.humanize.constantize
>
> what does humanize do here ?
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/loomio/loomio/pull/1281/files#r9571095>
> .
>