Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

inherited views for Rails 3.1

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 inherited_rails_views.gemspec
Readme.md

DRY views

The old inherited views project by Fred was a great idea. With Rails 3.1, inherited views got even simpler. This Project provides you with basic views for your CRUD actions. No generators, no nothing ;)

Install

Add the inherited_rails_views gem to your Applications Gemfile:

gem 'inherited_rails_views'

Usage

class TestsController < InheritedResources::Base
    include InheritedRailsViews

    # now all attributes of collection are shown in the views.
    # You can, however, specify which ones should be used.
    before_filter do
        inherited_attributes :attr1, :attr2, :attr3 => {:value => "Custom Titled Attribute", :type => :checkbox}
    end
end

You can also override any of the files in https://github .com/rweng/inherited_rails_views/tree/master/lib/inherited_rails_views/views/application.

Internationalization

Inherited Rails Views provides provides and uses the method irv_t for translations. irv_t takes a lazy lookup string and tries to look up the translation over different paths. Example:

# called from /countries/index
irv_t "actions.show", :default => "Show This", :bla => 1
# tries looking up in the following order:
# countries.index.actions.show
# countries.actions.show
# application.index.actions.show
# application.actions.show
# actions.show

If none of translation keys are set, "Show This" is displayed. The variable bla is passed in the localization value.

Something went wrong with that request. Please try again.