diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/generators/inboxes/views_generator.rb | 7 | ||||
| -rw-r--r-- | lib/inboxes.rb | 5 | ||||
| -rw-r--r-- | lib/inboxes/active_record_extension.rb | 13 |
3 files changed, 20 insertions, 5 deletions
diff --git a/lib/generators/inboxes/views_generator.rb b/lib/generators/inboxes/views_generator.rb index c69812e..07200ae 100644 --- a/lib/generators/inboxes/views_generator.rb +++ b/lib/generators/inboxes/views_generator.rb @@ -7,11 +7,10 @@ module Inboxes class_option :template_engine, :type => :string, :aliases => '-e', :desc => 'Template engine for the views. Available options are "erb" and "haml".' def copy_or_fetch - # puts "Generating views" - filename_pattern = File.join self.class.source_root, "*/*.html.#{template_engine}" - # puts (Dir.glob(filename_pattern).map {|f| File.basename f}).inspect + # filename_pattern = File.join self.class.source_root, "discussions", "*.html.#{template_engine}" + # puts Dir.glob(filename_pattern).map {|f| File.basename f}.inspect # Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f| - # copy_file f, "app/views/#{f}" + # # copy_file f, "app/views/#{f}" # end end diff --git a/lib/inboxes.rb b/lib/inboxes.rb index 9759f07..49bec39 100644 --- a/lib/inboxes.rb +++ b/lib/inboxes.rb @@ -1,9 +1,9 @@ require "inboxes/version" require "inboxes/railtie" require "inboxes/engine" +require "inboxes/active_record_extension" module Inboxes - # Your code goes here... def self.configure(&block) yield @config ||= Inboxes::Configuration.new @@ -24,4 +24,7 @@ module Inboxes end end + # adding method inboxes for models + ActiveRecord::Base.extend(Inboxes::ActiveRecordExtension) + end diff --git a/lib/inboxes/active_record_extension.rb b/lib/inboxes/active_record_extension.rb new file mode 100644 index 0000000..1cb94f2 --- /dev/null +++ b/lib/inboxes/active_record_extension.rb @@ -0,0 +1,13 @@ +module Inboxes + module ActiveRecordExtension + def inboxes(options = {}) + # field = options[:as] || name + # prefix = options[:prefix] || "with" + + has_many :speakers, :dependent => :destroy + has_many :discussions, :through => :speakers + + # scope "#{prefix}_#{name}", lambda {|value| where("#{field}" => value) } + end + end +end
\ No newline at end of file |
