Kev Jackson
2005-Oct-26 10:52 UTC
does latest rails version (0.14.2) support vendor/plugins?
http://jamis.jamisbuck.org/articles/2005/10/11/plugging-into-rails Seems to be a good way to add in the ActsAsHidable that I want to implement. I''ve built the directory structure as shown and written the code as described in a previous post, but Rails 0.14.2 is either a: not actually loaded - it''s using an older version b: loaded but doesn''t support this plugin feature c: loaded supports the feature but I''ve got something wrong with the config Sorry to bug people, but I can''t find an answer through google Also can''t find any description of how to define your own acts as whatever ActiveRecord::Acts base documentation isn''t where I thought it would be Kev
Rick Olson
2005-Oct-26 14:22 UTC
Re: does latest rails version (0.14.2) support vendor/plugins?
On 10/26/05, Kev Jackson <kevin.jackson-1n8Jz8fJjQ+aMJb+Lgu22Q@public.gmane.org> wrote:> http://jamis.jamisbuck.org/articles/2005/10/11/plugging-into-rails > > Seems to be a good way to add in the ActsAsHidable that I want to > implement. I''ve built the directory structure as shown and written the > code as described in a previous post, but Rails 0.14.2 is either > a: not actually loaded - it''s using an older version > b: loaded but doesn''t support this plugin feature > c: loaded supports the feature but I''ve got something wrong with the config > > Sorry to bug people, but I can''t find an answer through google > > Also can''t find any description of how to define your own acts as > whatever ActiveRecord::Acts base documentation isn''t where I thought it > would be > > Kev0.14.0 should have had this feature. I''ve been writing a lot of plugins since the support was checked in. Act methods are just class methods on ActiveRecord. I think acts_as_paranoid is the simplest example you can get. http://techno-weenie.net/svn/projects/acts_as_paranoid/lib/acts_as_paranoid.rb -- rick http://techno-weenie.net
Adam Roth
2005-Nov-02 04:41 UTC
Re: does latest rails version (0.14.2) support vendor/plugins?
Kev (and list), Plugis aren''t working for me either. Did you figure this out? I just tried to use them for the first time tonight, but nothing in vendor/plugins is being "included". Here is a simple test and some debug information for anyone else who may be able to help: OS X 10.3 Rails 0.14.2 $:/var/httpd/rails/test/vendor/plugins root# ls -l total 0 drwxr-xr-x 6 aroth wheel 204 1 Nov 22:09 assert_valid_markup drwxr-xr-x 10 aroth wheel 340 1 Nov 22:09 file_column class TestController < ApplicationController assert_valid_markup :index def index render_text "testing test test..." end end ....and when I hit /test: Application Trace: "NoMethodError in <controller not set>#<action not set> undefined method `assert_valid_markup'' for TestController:Class RAILS_ROOT: . Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/controllers/test_controller.rb:5 #{RAILS_ROOT}outing.rb:234:in `traverse_to_controller'' #{RAILS_ROOT}enerated/routing/recognition.rb:3:in `eval'' #{RAILS_ROOT}enerated/routing/recognition.rb:3:in `recognize_path''" Full Trace: "#{RAILS_ROOT}/app/controllers/test_controller.rb:5 #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:206:in `load'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:206:in `load'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:38:in `require_or_load'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:21:in `depend_on'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:177:in `require_dependency'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:177:in `require_dependency'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:133:in `load_file!'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:96:in `const_load!'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:79:in `each'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:79:in `const_load!'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:71:in `const_missing'' #{RAILS_ROOT}outing.rb:234:in `traverse_to_controller'' #{RAILS_ROOT}enerated/routing/recognition.rb:3:in `eval'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/routing.rb:234:in `traverse_to_controller'' #{RAILS_ROOT}enerated/routing/recognition.rb:3:in `recognize_path'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/actionpack-1.10.2/lib/action_controller/routing.rb:458:in `recognize!'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/dispatcher.rb:36:in `dispatch'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/webrick_server.rb:117:in `handle_dispatch'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/webrick_server.rb:83:in `service'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/server.rb:94:in `start'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/server.rb:89:in `each'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/server.rb:89:in `start'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start'' #{RAILS_ROOT}usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/webrick_server.rb:69:in `dispatch'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/rails-0.14.2 /lib/commands/server.rb:59 #{RAILS_ROOT}usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__'' #{RAILS_ROOT}usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'' #{RAILS_ROOT}usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.2/lib/active_support/dependencies.rb:213:in `require'' #{RAILS_ROOT}cript/server:3" Any ideas? Adam On 10/26/05, Kev Jackson <kevin.jackson-1n8Jz8fJjQ+aMJb+Lgu22Q@public.gmane.org> wrote:> > http://jamis.jamisbuck.org/articles/2005/10/11/plugging-into-rails > > Seems to be a good way to add in the ActsAsHidable that I want to > implement. I''ve built the directory structure as shown and written the > code as described in a previous post, but Rails 0.14.2 is either > a: not actually loaded - it''s using an older version > b: loaded but doesn''t support this plugin feature > c: loaded supports the feature but I''ve got something wrong with the > config > > Sorry to bug people, but I can''t find an answer through google > > Also can''t find any description of how to define your own acts as > whatever ActiveRecord::Acts base documentation isn''t where I thought it > would be > > Kev > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Kev Jackson
2005-Nov-02 04:57 UTC
Re: does latest rails version (0.14.2) support vendor/plugins?
Adam Roth wrote:> Kev (and list), > > Plugis aren''t working for me either. Did you figure this out? I just > tried to use them for the first time tonight, but nothing in > vendor/plugins is being "included". Here is a simple test and some > debug information for anyone else who may be able to help: > > OS X 10.3 > Rails 0.14.2Yeah I got it working in the end. I started by using the code as actas_as_chunky_bacon, but my init.rb wasn''t correct. Anyway - here''s my acts_as_hidable code easy one first... vendor/plugins/acts_as_hidable/init.rb require ''acts_as_hidable'' vendor/plugins/acts_as_hidable/lib/acts_as_hidable.rb require ''active_record'' module ActiveRecord module Acts #:nodoc: module Hidable #:nodoc: def self.append_features(base) super base.extend(ClassMethods) end # Adds a find_all_visible method which finds all records which are not hidden module ClassMethods def acts_as_hidable class_eval do extend ActiveRecord::Acts::Hidable::SingletonMethods end end end module SingletonMethods def find_all_visible find(:all, :conditions => ''hidden = false'') end def find_all_hidden find(:all, :conditions => ''hidden = true'') end end end end end ActiveRecord::Base.class_eval do include ActiveRecord::Acts::Hidable end When I first started I was using a project I''d generated with rails 0.13.1, but I''d updated to rails 0.14.x (gem update rails), but I hadn''t regenerated the app - that was the first problem, second problem was that the code was a little borked. This one works fine however Note: WinXP, one-click-Ruby, + gems install rails - WEBRick, not lighttpd/apache Kev
Trevor Squires
2005-Nov-02 05:06 UTC
Re: does latest rails version (0.14.2) support vendor/plugins?
Hi Adam, I just tried my own plugin (ActiveRecord Enumerations - listed on http://wiki.rubyonrails.org/rails/pages/Plugins) and it works fine on OS X 10.3.9 and rails 0.14.2 Try editing the init.rb file for your installed plugins and stick a "puts ''I got loaded''" at the start, run ./script/console and see if your message appears... That should at least get you started. Regards, Trevor On 1-Nov-05, at 8:41 PM, Adam Roth wrote:> Kev (and list), > > Plugis aren''t working for me either. Did you figure this out? I just > tried > to use them for the first time tonight, but nothing in vendor/plugins > is > being "included". Here is a simple test and some debug information for > anyone else who may be able to help: >-- Trevor Squires http://somethinglearned.com
Adam Roth
2005-Nov-02 05:21 UTC
Re: does latest rails version (0.14.2) support vendor/plugins?
Trevor Thanks for your reply. I tried what you suggested and they are both loaded, or atleast the put statement is being executed, $:/var/httpd/rails/lemons root# script/server I got loaded (file_column) I got loaded (assert_valid_markup) => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2005-11-01 23:16:44] INFO WEBrick 1.3.1 ...but I''m still getting those errors. Using file_column: NoMethodError in <controller not set>#<action not set> undefined method `file_column'' for TestController:Class RAILS_ROOT: . .... hmm. I even uninstalled all the old gems and reinstalled from scratch to see if my installation was broken. Any other ideas? Adam On 11/1/05, Trevor Squires <trevor-k8q5a0yEZAgS+FvcfC7Uqw@public.gmane.org> wrote:> Hi Adam, > > I just tried my own plugin (ActiveRecord Enumerations - listed on > http://wiki.rubyonrails.org/rails/pages/Plugins) and it works fine on > OS X 10.3.9 and rails 0.14.2 > > Try editing the init.rb file for your installed plugins and stick a > "puts ''I got loaded''" at the start, run ./script/console and see if > your message appears... > > That should at least get you started. > > Regards, > Trevor > > On 1-Nov-05, at 8:41 PM, Adam Roth wrote: > > > Kev (and list), > > > > Plugis aren''t working for me either. Did you figure this out? I just > > tried > > to use them for the first time tonight, but nothing in vendor/plugins > > is > > being "included". Here is a simple test and some debug information for > > anyone else who may be able to help: > > > -- > Trevor Squires > http://somethinglearned.com > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >