Follow Along as I Stumble on the Path to Learning RoR

Posts tagged “view

ActiveAdmin Translation Missing Error

I was receiving a translation missing message that was showing up on my page views for my ActiveAdmin page.  To correct this, I found the solution on Stack Overflow which said that these translations were just missing from my en.yml file in locales, and to replace my existing one with the one here (that ActiveAdmin uses):

https://github.com/gregbell/active_admin/blob/master/lib/active_admin/locales/en.yml

Advertisements

Simple Authentication with Rails 3.1

If you need a simple authentication, for example some views that only one person should have access to, you might consider:

http_basic_authenticate_with :name => "username", :password => "pass"

provided by Rails 3.1, it’s a way to protect some pages that only a select few may need access to. Just place that in your controller.
To limit the actions this applies to, you can add :only or :except such as:

http_basic_authenticate_with :name => "username", :password => "pass", :except => :index

Where to put code?

It was confusing for me figuring out where to put logic.  As it turns out, I had way too much code in my controllers and views – this should have been in my models and helpers.

This is a great post:

http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model

 

Also, view:

http://stackoverflow.com/questions/60658/rails-model-view-controller-and-helper-what-goes-where