Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

topic_topic & bcrypt

  • Loading branch information...
commit 359677227472ab881096cbcc47ed50f27180177b 1 parent 0064fbb
@jdwyah authored
View
2  app/models/topic.rb
@@ -1,3 +1,5 @@
class Topic < ActiveRecord::Base
belongs_to :user
+ has_many :topics, :through => :topics_topics, :source => :to
+ has_many :topics_topics, :class_name => 'TopicsTopic', :foreign_key => :from_id
end
View
4 app/models/topics_topic.rb
@@ -0,0 +1,4 @@
+class TopicsTopic < ActiveRecord::Base
+ belongs_to :to, :class_name => 'Topic', :foreign_key => 'to_id'
+ belongs_to :from, :class_name => 'Topic', :foreign_key => 'from_id'
+end
View
6 app/views/users/show.html.haml
@@ -3,4 +3,8 @@
%ol
- for topic in @user.topics
%li
- == Title #{topic.title} Type #{topic.type}
+ == Title #{topic.id} #{topic.title} Type #{topic.type}
+ %ol
+ - for has in topic.topics
+ %li
+ == !!!!!Has #{has.title} type #{has.type}
View
2  config/environment.rb
@@ -21,7 +21,7 @@
# config.gem "aws-s3", :lib => "aws/s3"
config.gem "haml", :version => '2.0.9'
config.gem "authlogic", :version => "2.0.5"
- config.gem "bcrypt-ruby"
+ config.gem "bcrypt-ruby", :lib => 'bcrypt', :version => "2.0.5"
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
Please sign in to comment.
Something went wrong with that request. Please try again.