i cannot seem to get observe_form to call a particular action
i have a route defined
map.resources :charges, :collection => {:charge_total => :get}
my controller
class ChargesController < ApplicationController
def charge_total
return 'foo'
end
end
my view: i have tried both...
observe_form form_id, :update => :charge_tota...
I have a standard rails observer configured:
class TipObserver < ActionController::Caching::Sweeper
observe Tip
def after_save(tip)
profile_link = link_to tip.profile.name, profile_path(tip.profile)
Profile.followers(tip.quality).each{|profile|
message = Message.new
message.sender = Profile.first
message.re...
I'm trying to understand the observer pattern using C#, first I have an abstract class working as Subject called Stock, then I'm creating a concreteSubject class so I'm going to call it IBM, as the concreteSubject Class is going to inherit from Stock, so I do something like this:
class IBM : Stock
{
// Constructor
public IBM(str...
I have a problem.
1. I have two threads 'worker' and 'UI' thread.
2. worker keep on waiting for data from server, when gets it notifies to UI thread.
3. On update UI Toast a msg on screen.
Step 3 is problem as it says
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch ...
I need to implement Observer Pattern in ASP.NET MVC. Can anyone guide me where I can find the skeleton of the classes for this or can provide me a skeleton itself?
I need to apply this pattern with the clear separation of model, view and controller.
Thanks.
...
I wonder why .NET framework doesn't have pair (Observer/Observable) interfaces similar to Java's feature?
EDIT:
yes i know about events and delegates but using those interfaces is a simple and bookish approach of this DP isn't it?
...
I have a standard Rails application.
When a Tip is created, I would like to create a Message for each User who is interested in that Tip.
This sounds simple right? It should be...
So, we start with a Tip Observer:
class TipObserver < ActiveRecord::Observer
def after_save(tip)
# after the tip is saved, we'll create some messages...
I need to refer to a controller method from a cache observer, How can I make it?
...
I am busy adding a generic observer mechanism to a legacy C++ application (using Visual Studio 2010, but not using .Net, so .Net delegates are out of the question).
In the design I want to separate the application-specific part as much as possible from the generic observer mechanism.
The most logical way of implementing observers seems...
Hi guys,
I wanted to find out other ways to do Asynchronous Observer Pattern without using Message Queue. Ideas and examples are mostly welcomed. :-) (Think of this as a brainstorming session).
PS Language preference is up to you.
...
Hi,
i need some practical examples of cases when i could use the observer pattern when developing a website.. (using php)
I have one "when a user publishes an Article (subject), the class RSS and the class EMAIL (the observers) will modify the rss and send an email to the admin", but i'm not even sure if this is a good example..
wher...
Straight to the point!
How do signals/slots and event/event-listeners compare?
Are there any pros and cons?
Which one should I consider and why?
Thanks in advance!
...
Hi,
I'm interested in the value change of a particular key which I keep in NSUserdefaults. However, what I have is not working for me. observeValueForKeyPath does not get triggered.
Update: I think I've discovered the issue. Rather than using a defined constant, if I use a string then it gets fired.
[[NSUserDefaults standardUserDefau...
I need to extend a class (in C++, but this question is language-agnostic I think), with functionality that can be implemented in two different ways:
by simply adding the logic to the class itself
by adding observer logic to the class and putting the logic in an observer, outside the class
There are advantages and disadvantages in bot...
I am new to Magento, but I thought I had a grasp on it until today. Here is my problem.
I am writing a new Observer to add a coupon to the cart on page load. The coupon code is passed in the URL and I desire the code to be passable through ANY working URL.
For example: http://magento/?coupon=MYCOUPON
I am catching on the event "contro...
I have a custom tree data class, following the standard Composite pattern. I obviously don't want the GUI and the model to be too closely tied, so the GUI should be an Observer of the model, and changes should be done through the model layer. I'm implementing observable support using C# events - so far, so good, and I have a working syst...
I'm working on a website where I sell products (one class Sale, one class Product). Whenever I sell a product, I want to save that action in a History table and I have decided to use the observer pattern to do this.
That is: my class Sales is the subject and the History class is the observer, whenever I call the save_sale() method of th...
This problem is pretty common: an object should notify all its subscribers when some event occurs. In C++ we may use boost::signals or something else. But how to do this in Go language? It would be nice to see some working code example where a couple of objects are subscribed to a publisher and process notifications.
Thanks
...
Hi,
I have different custom map annotations on my MKMapView, and when creating the custom view I add an observer and disable the default popup.
At the top of MapViewController.m:
static NSString* const ANNOTATION_SELECTED_DESELECTED = @"annotationSelectedOrDeselected";
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotat...
Hello,
I am trying to use observers in my rails app to create a new entry in my "Events" Model every time a new "Comment" is saved. The comments are saving fine, but the observer is not creating events properly.
// comment_observer.rb
class CommentObserver < ActiveRecord::Observer
observe :comment
def after_save(comment)
...