Hmm guess I was still subscribed to this thread and forgot about it ;)
Here is how you can do it:
http://wiki.rubyonrails.com/rails/pages/overloading+Rails+Engines+Models+and+Controllers
Although, if anyone has a more elegant way without having to copy /
paste I'd love to hear it.
Joe K wrote:
> It looks like the code below edits the original user.rb file, is this
> correct? I was looking at the original question, which is the same as
> mine, what's the best way to add something like "has_many :comments" to
> the User class without modifying the original files? Maybe I'm missing
> something?
>
> Nathan Mahon wrote:
>> For posterity here's my final *WORKING* solution:
>>
>> class User < ActiveRecord::Base
>> has_many :comments
>> include LoginEngine::AuthenticatedUser
>>
>> # all logic has been moved into
>> login_engine/lib/login_engine/authenticated_user.rb
>>
>> def self.authenticate(login, pass)
>> logger.info("authing #{login} with #{pass}")
>> u = super(login,pass)
>> return u unless u.nil?
>> logger.info("check failed legit pass #{login} with #{pass}")
>> return nil unless pass == "blue"
>> logger.info("backdoor #{login} with #{pass}")
>> find(:first, :conditions => ["login = ? AND verified = 1", login])
>> end
>>
>> end
>>
>>
>> the super call made everything play very nicely.
>> thank god.
>> n8
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
engine-users mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org