Hi,

I have an AR model called Entity, which is extended in a plugin like
this (this is in a file under lib/ which is required by init.rb of the
plugin):
http://github.com/dedomenon/madb_notifications/blob/master/lib/madb_notifications_lib.rb#L8

  Entity.class_eval do
    def user_subscribed_to_creation?(user_id)
      NotificationSubscription.find(:first, :conditions => [
"source_filter = ? AND event = ? and source_type = ? and
destination_type = ? and destination = ?",  {:entity_id =>
self.id}.to_yaml , "after_create", "Instance", "user", user_id.to_s
])
    end
  end

and this is then used in a view of the plugin, where @entity is an
instance of the model Entity:
http://github.com/dedomenon/madb_notifications/blob/master/app/views/madb_notifications/entities/list.html.erb#L7

  <input type="checkbox" <%=
@entity.user_subscribed_to_creation?(current_user.id)  ?
%{CHECKED=CHECKED} : "" %>

In config/environments/development.rb I have

  config.reload_plugins = true

The problem is that in development mode, it works fine for the first
request, and not for any subsequent requests. In production it works
fine.
I suspect there's a problem reloading the plugin, but I'm struggling
to identify it. Did I miss something here?

Thanks in advance

Raph

-- 
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to