Overwrites to_s method on models with attributes like "name", "title" etc..
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
Readme.markdown
default_name.gemspec

Readme.markdown

Default Name

This gem overwrites the "to_s" method for all models that have attributes named:

name, title, short_name, long_name

This is handy because largely you have that one main attribute that is representing your model.

Installation

To install this gem, add it to your Gemfile

gem 'default_name'

Usage

In your controller:

@company = Company.find(1)
@company.name = "Some company"

And in your view:

<%= @company >

It will fire "Some company".

Copyright (c) 2013 Tomislav Car, released under the MIT license