- 浏览: 2052492 次
- 性别:
- 来自: NYC
文章分类
- 全部博客 (628)
- Linux (53)
- RubyOnRails (294)
- HTML (8)
- 手册指南 (5)
- Mysql (14)
- PHP (3)
- Rails 汇总 (13)
- 读书 (22)
- plugin 插件介绍与应用 (12)
- Flex (2)
- Ruby技巧 (7)
- Gem包介绍 (1)
- javascript Jquery ext prototype (21)
- IT生活 (6)
- 小工具 (4)
- PHP 部署 drupal (1)
- javascript Jquery sort plugin 插件 (2)
- iphone siri ios (1)
- Ruby On Rails (106)
- 编程概念 (1)
- Unit Test (4)
- Ruby 1.9 (24)
- rake (1)
- Postgresql (6)
- ruby (5)
- respond_to? (1)
- method_missing (1)
- git (8)
- Rspec (1)
- ios (1)
- jquery (1)
- Sinatra (1)
最新评论
-
dadadada2x:
user模型里加上 protected def email ...
流行的权限管理 gem devise的定制 -
Sev7en_jun:
shrekting 写道var pattern = /^(0| ...
强悍的ip格式 正则表达式验证 -
jiasanshou:
好文章!!!
RPM包rpmbuild SPEC文件深度说明 -
寻得乐中乐:
link_to其实就是个a标签,使用css控制,添加一个参数: ...
Rails在link_to中加参数 -
aiafei0001:
完全看不懂,不知所然.能表达清楚一点?
"$ is not defined" 的问题怎么办
updated:
06/30/2013
0.1 image/video attach to news/article
project url
1 老师学生 many to many
2. User friends自身关联,单向
3. User 有两种角色学生和老师,自身关联
06/30/2013
0.1 image/video attach to news/article
project url
class Article < ActiveRecord::Base has_many :attachable_entities, as: :entity has_many :attachables, through: :attachable_entities, source: :attachable, source_type: Image end class AttachableEntity < ActiveRecord::Base belongs_to :entity, polymorphic: true belongs_to :attachable, polymorphic: true end class Image < ActiveRecord::Base has_many :attachable_entities, as: :attachable has_many :entities, through: :attachable_entities, source: :entity, source_type: Article end
1 老师学生 many to many
class Student < ActiveRecord::Base attr_accessible :name has_many :student_teacher_links has_many :teachers, through: :student_teacher_links end class Teacher < ActiveRecord::Base attr_accessible :name has_many :student_teacher_links has_many :students, through: :student_teacher_links end class StudentTeacherLink < ActiveRecord::Base belongs_to :student belongs_to :teacher # attr_accessible :title, :body end
2. User friends自身关联,单向
class User < ActiveRecord::Base attr_accessible :name has_many :friend_links has_many :friends, through: :friend_links has_many :ofriend_links, foreign_key: :friend_id, class_name: :FriendLink has_many :ofriends, through: :ofriend_links, source: :user def allfriends friends + ofriends end end class FriendLink < ActiveRecord::Base attr_accessible :friend_id, :user_id belongs_to :user belongs_to :friend, class_name: :User end
3. User 有两种角色学生和老师,自身关联
class User < ActiveRecord::Base attr_accessible :name has_many :student_links, foreign_key: :student_id, class_name: :StudentTeacherLink has_many :students, through: :student_links has_many :teacher_links, foreign_key: :teacher_id, class_name: :StudentTeacherLink has_many :teachers, through: :teacher_links #has_many :students, through: :student_teacher_links#, source: :student_id#, class_name: :StudentTeacherLink #has_many :teachers, through: :student_teacher_links#, class_name: :StudentTeacherLink end class StudentTeacherLink < ActiveRecord::Base attr_accessible :student_id, :teacher_id belongs_to :teacher, foreign_key: :student_id, class_name: :User#as: :student_id belongs_to :student, foreign_key: :teacher_id, class_name: :User#as: :student_id #belongs_to :user#, as: :teachers end
发表评论
-
brew service restart
2013-07-06 22:56 1389brew services restart memcached ... -
git如何合并 多个commit
2013-07-02 20:42 9310需要先搞明白rebase 然后,进这个界面 pick b ... -
rvm create gemset
2013-07-01 09:00 1221rvm ruby-1.9.3-p429 do rvm gems ... -
关于devise结合github通过omniauth登录
2013-06-24 04:47 4109最近写了个github帐户登录Demo: https://gi ... -
cdata 和 xml xmlParseEntityRef: no name 错误
2013-05-04 00:24 4946Problem: An XML parser returns ... -
一目了然 rails html xml encode decode
2013-05-03 23:37 30601.9.2p320 :001 > require ' ... -
使用scope 链接多个where条件
2013-05-02 09:17 2570scope :by_category, (lamb ... -
在rspec里使用 route path
2013-05-01 20:09 968Rspec.configure do |config| ... -
select_tag default value & options
2013-04-10 21:40 2161#If you are using select_tag ... -
Jquery array remove
2013-04-10 21:38 4495Array.prototype.remove = fu ... -
ruby readline的两种写法
2013-04-09 10:21 868f = File.read('public/file.cs ... -
关于encoding utf-8
2013-04-04 20:55 4054一 gem解决方案 https://github.com/m- ... -
我见过最清楚的解释class_eval 和 instance_eval
2013-04-02 07:06 3281忘了,看一次就能回忆起来 class A # def ... -
multiple provider oauth
2013-04-01 11:13 1242Allowing users to login with mu ... -
oauth github和multiple oauth
2013-04-01 11:08 1523http://railscasts.com/episodes/ ... -
Ruby Jquery 地图,地理信息相关资源
2013-03-22 20:32 903Railscast Geocorder Geocorde ... -
load migrate file and load
2013-03-22 05:52 964Dir[Rails.root.join('db','mig ... -
Brew update problem
2013-03-22 05:48 1295引用 MBA:~ fortin$ brew update er ... -
Jquery sort table number
2013-03-19 01:01 1112So here is what the column is s ... -
update_all
2013-03-13 02:09 1308Article.limit(2).update_all [&q ...
相关推荐
auto corelation matlab函数,matlan计量包
Neural_Relation_Extraction 代码
Api-active_hash_relation.zip,activehash relation:简单的gem,允许您使用hash运行多个activerecord::relation。非常适合apis.activehashrelation,一个api可以被认为是多个软件设备之间通信的指导手册。例如,...
资源来自pypi官网。 资源全名:air_drf_relation-0.0.8.tar.gz
rdf三元组抽取,多头实体关系联合抽取模型,基于pytorch,tensorflow两种框架实现
BERT-Relation-Extraction
一个普通的具有收缩和放大的喷嘴设计模型, 用matlab编写完成
trytond-product_purchase_line_relation
少样本网络relation network的模型下载,可以直接用于该网络的识别,运行该模型就可以进行识别了
Pstage_03_KLUE_Relation_extraction 训练 python train.py 推理 python inference.py --model_dir = [model_path] 例如)python inference.py --model_dir =。/ results / checkpoint-500 评估 python eval_acc.py
pfe_revit_relation_bidirectionnelle:M2 PFE Efrei巴黎
联合实体识别和关系提取作为多头选择问题论文的实现以及。要求Ubuntu 16.04 水蟒5.0.1 脾气暴躁的1.14.1 Gensim 3.4.0 Tensorflow 1.5.0 漂亮表0.7.2任务给定一系列标记(即句子),(i)给出每个单词(例如NER)的...
产品具有共同的属性( name , price , image等),而每种类型的产品都有其自身的属性... pen具有color , book具有author和publisher等。 安装 对于Rails 4安装, Gemfile添加到您的Gemfile gem 'acts_as_...
请参阅.gitmodules并将引用的.gitmodules库克隆到object_relation_transformer文件夹中。 库,用于生成不同的评估指标。 要进行设置,请将存储库克隆到object_relation_transformer文件夹中。 确保将克隆的存储库...
relation-graph图谱移动端适配拖动修复代码
Entity_Relation_Extraction 英语实体关系提取 使用双向LSTM神经网络和Attention机制,将词嵌入作为输入在SemEval2010 task8数据集上,以预测每个实体对的关系类别。 经过100次训练后达到了63%的F1分数。 环境 从...
数据格式: one_good_relation \t several_negative_relations_pool \t question
数据格式: one_good_relation \t several_negative_relations_pool \t question
图 关联实体 查询 图 关联实体 查询 英文论文 128页
每一种关系的标注数量如下图: 模型结构 从BERT获得三个向量。 [CLS]令牌向量 实体_1平均向量 平均实体_2向量 将每个矢量传递到完全连接的层。 退出-> tanh-> fc-layer 连接三个向量。 将串联的矢量传递到完全...