# == Schema Information # # Table name: action_node_selects # # id :integer not null, primary key # action_nodes_id :integer # name :string(255) # val :string(255) # val_ext :string(255) # description :string(255) # download_url :string(255) # sort_no :integer default("0") # use_count :integer default("0") # user_id :integer # created_at :datetime not null # updated_at :datetime not null # # Indexes # # index_action_node_selects_on_action_nodes_id (action_nodes_id) # index_action_node_selects_on_name (name) # index_action_node_selects_on_user_id (user_id) # class Action::NodeSelect < ApplicationRecord self.table_name = 'action_node_selects' default_scope { order(sort_no: :asc) } belongs_to :action_node, :class_name => 'Action::Node', foreign_key: "action_nodes_id" belongs_to :user, optional: true validates :name, presence: { message: "不能为空" } validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"} def value if self.val_ext.blank? self.val else "#{self.val}@#{self.val_ext}" end end end