Sha256: cacbc5bc9d5c78f2ecd01b8f6e8cdd9065269e6a6468881942513a2cd2e00053

Contents?: true

Size: 687 Bytes

Versions: 38

Compression:

Stored size: 687 Bytes

Contents

module CreatedByHelper
  def text_created_by(model, action = "create", mode = "short")
    begin
      if action.include?("update")
        id = model.updated_by
        time = model.updated_at
      else
        id = model.created_by
        time = model.created_at
      end
      user = <%= user.camelize %>.find(id)
      name = user.name
      email = user.email
    rescue
      return ""
    end
    case mode
      when "name"
        name
      when "email"
        email
      when "user"
        mail_to(email, name)
      when "long"
        "#{mail_to(email, name)} (#{l(time)})"
      else          
        "#{mail_to(email, name)} (#{l(time.to_date)})"
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
bootswatch_rails-3.3.0.7 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.6 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.5 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.4 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.3 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.2 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.3.0.1 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.43 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.42 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.41 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.40 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.39 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.38 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.37 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.36 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.35 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.34 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.33 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.32 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb
bootswatch_rails-3.2.0.31 lib/generators/bootswatch_rails/created_by/templates/created_by_helper.rb