Socket
Book a DemoInstallSign in
Socket

enum_select_rails

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enum_select_rails

0.3.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

EnumSelectRails

Gem Version

A form helper for the enum field of Rails model.

You can easily generate select tag which has enum field options.

image

Installation

Add this line to your application's Gemfile:

gem 'enum_select_rails'

Usage

class User
  enum gender: {    
    female: 2,
    male: 1,
    other: 9
  }
end
<%= f.enum_select :gender %>

i18n

Automatically apply i18n text into options text.

This feature is depends on enum_help.

image

# Gemfile
gem 'enum_help'
# application.rb
# i18n
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
# config/locales/models/user/ja.yml
ja:
  activerecord:
    models:
      user: ユーザー
    attributes:
      user:
        gender: 性別
  enums:
    user:
      gender:
        female: 女性
        male: 男性
        other: その他

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 24 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.