Git Product home page Git Product logo

apotomo's People

Contributors

amalagaura avatar apotonick avatar bluntpeak avatar cj avatar docwhat avatar georgiev avatar gregoriokusowski avatar koenpunt avatar kuraga avatar lcowell avatar nerian avatar paneq avatar pnomolos avatar prusnak avatar senny avatar zoer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apotomo's Issues

error messages hiding root cause

It seems as if when I have an error in my x_widget.rb file, the error message claims the error comes from the template where render_widget is being called and shows the source for that, making it hard to realize what/where the problem really is.

Luckily, once I figured that out, when I see an error, I skip the template and go straight to the widget and try to use the few clues that were given to me to figure out the problem, but it would be nice to have this work properly.

initiale state in widget call raises wrong deprecation warning

In my controller i call

  has_widgets do |root|
    root << widget(:transaction, 'transaction_form')
    root << widget(:balance, :balance_widget)
    root << widget(:transaction, 'transaction_list')
  end

in the view

  = render_widget(:transaction_form)
  #suggest
  = render_widget(:balance_widget)
  = render_widget(:transaction_list, :list)

and than i get the following warning:

Deprecated. Use #options for widget constructor options or #params for request data.
for the line with the initial list state
5: = render_widget(:transaction_list, :list)

Apotomo using Jruby-1.6.5 and rails 3.1.1

Hi

I have one issue when using apotomo in Jruby-1.6.5 (hook with ruby 1.9.2) and I use rails 3.1.1

when i call render_widget

this errors is always happen

"wrong number of arguments (2 for 1)", I've follow the tutorial step by step

but the error still occured

Did you have any idea? or apotomo does not jruby yet?

Thanks

url_for_event does not work with nested routes.

Say I have an meeting management website. To access a meeting you go to URL

http://meeting.com/meeting/1

and you are presented with the web interface for a meeting with id = 1. Each meeting can have a comments thread and the comments thread is embedded within an Apotomo cell. All is good :). My meetings controller is

class EventsController < ApplicationController
  respond_to :html, :js

  # CANCAN should load the resource
  load_resource :only => :render_event_response

  has_widgets do |root|
    root << panel = widget("comments/panel", :comments, :meeting => @meeting)
  end

   ...
end

The @MeetIng object is loaded via CANCA and passed to the main widget. However I now have a problem in that I wish to have an Apotomo event called for deleting a comment. In my view I create a link for my delete button.

  = link_to url_for_event(:destroy,
         :source => widget_id, 
         :id => @meeting.id, 
         :comment_id => comment.id),
         remote: true

The extra parameter :id => @meeting.id should not be necessary as url_for_event is being called in the context of http://meeting.com/meeting/1 and the url should either be generated as

http://meeting.com/meeting/1/render_event_response?.... params ...

or

http://meeting.com/meeting/render_event_response?id=1&....params....

or am I doing something totally back to front here. Having to put the

             :id => @meeting.id, 

explicity in the call to url_for_event is breaking encapsulation as meeting should be passed into the widget from the top level.

Easier Transition From Cells To Apotomo

What about making the - somehow clumsy - has_widgets block optional in Apotomo?

Two simple suggestions.

  1. Apotomo could automatically find out which widget is refered to in an event processing request. This way, you'd just use render_widget in your views without the need for has_widgets. Problem: In an event request, you can't pass options to the widget.
  2. To make passing options possible, introduce #use_widget which accepts a block evaluated in controller instance context.
class DashboardController < ApplicationController

use_widget :comments { :user => current_user }

This is supposed to read simpler than this.

class DashboardController < ApplicationController
  has_widgets do |root|
    root << widget(:comments, :user => current_user)
  end

using render_event_response url_helper

When I try to respond to an ajax event request with the url helper url_for_event(:my_event) The request is routed to wrong place. It tries to route to the show action of the controller. This is caused by the resource route which is above the apotomo route.
If I add to my routes.rb on the top before all resources:


  match ":controller/render_event_response", :to => "#render_event_response", :as => "apotomo_event"

than the routing is correct.

Is it an apotomo bug?

10x!

Not working with Rails 3.0.1/3.0.0

a pristine rails 3 app with:
rails generate apotomo:widget CommentsWidget display process
class HomeController < ApplicationController
include Apotomo::Rails::ControllerMethods

has_widgets do |root|
  root << widget('comments_widget', 'post-comments', :display)
end

end

and
<%= render_widget 'post-comments' %> in the view

Error:
wrong number of arguments (1 for 0)
Extracted source (around line #1):

1: <%= render_widget 'post-comments' %>

backtrace:

cells (3.4.2) lib/cell/rails.rb:32:in process' cells (3.4.2) lib/cell/rails.rb:32:inrender_state'
cells (3.4.2) lib/cell/caching.rb:95:in render_state' apotomo (1.0.0.beta2) lib/apotomo/widget.rb:122:ininvoke'
apotomo (1.0.0.beta2) lib/apotomo/request_processor.rb:78:in render_widget_for' apotomo (1.0.0.beta2) lib/apotomo/rails/controller_methods.rb:92:inrender_widget'
apotomo (1.0.0.beta2) lib/apotomo/rails/view_methods.rb:4:in __send__' apotomo (1.0.0.beta2) lib/apotomo/rails/view_methods.rb:4:inrender_widget'
app/views/home/index.html.erb:1:in `_app_views_home_index_html_erb__218612812_22451880_0'

default_url_options

I use apotomo v1.beta2 with rails 3
When I use url helpers in widget view I receive an error:

Missing host to link to! Please provide :host parameter or set default_url_options[:host]

To solve it I had to add a method to the widget controller:


 def default_url_options(options={})
    { :host => request.host_with_port }
 end

Is there a better way to solve this issue?

Thanks for the great framework!!

Invocation of callback function after update or replace

Hi Nick.

What is our opinion on making possible to specify a callback function(or array of functions) that will be invoked after update or replace.

I'll try to explain. I use coffeescript and I don't embed javascript within haml view. I have application.coffee that bind events to ajax requests. One way to call a function after update is to hook a callback function on ajax complete event. For example in Peter's Guide when new tweet is added tweets list updated and it's necessary to make tweets draggble again. The same is necessary when tweet is dumped and tweet list updated. I think instead of specifying one callback for tweet add and one more the same callback for tweet delete, it's reasonable to let update(and replace) method accept something like :callback option, that can specify function that will be invoked when update is finished. Then it's probably will be useful to specify arguments that passed to this function(s), and maybe make conventional case on :callback => true parameter.

I just started going through Peter's Guide and I have quick&dirty solution, but its will be enough to catch the idea:
# config/initializers/apotomo.rb

Apotomo::Widget.class_eval do
  def update_with_callback(*args)
    update(*args) + callback_function(*args)
  end

  def replace_with_callback(*args)
    replace(*args) + callback_function(*args)
  end

private
  def callback_function(*args)
    func_name = ((arg = args.last).instance_of?(Hash) && arg[:callback]) ||
      self.class.name.chomp('Widget').underscore

    "((typeof(Rails.Callbacks.#{func_name}) == 'function') && \
      Rails.Callbacks.#{func_name}('#{widget_id}'));"
 end
end

How to understand README

I don't understand the README example, but I do understand the screencasts.

root << widget('comments_widget', 'post-comments', :post => @post)
end
The widget is named post-comments.

You only have comments_widget defined below:

class CommentsWidget < Apotomo::Widget

Where is post-comments? What are the second arguments to widget() I thought they are paramters, like :post ?

Where is this defined in your example on the readme? The only widget you defined was CommentsWidget

= render_widget 'post-comments'

Pass Instance Variable to View

Hi Guru,

I am new to Apotomo. In my use case, I want to change content dynamically after submit a new form. The question is how to pass the newly created instance 'task' to the view!

def submit(evt)
task = Task.create(evt[:checkin])
replace "#d_task_post", :view => :post_task
end

Thanks!

render_event_response: support for non-js

I wanted widgets to make work smoothly also without javascript enabled. For this I wanted to return HTML for widget decorated with application layout.

Unfortunately render_event_response:

  1. has hardcoded content-type Mime::JS, thus content is not rendered as HTML when I return it directly,
  2. it is impossible to adjust render, eg. to add :layout

I would be nice if it could be configurable, so it's easy to make fallback system for non-js use (or if someone clicks "open in new tab").

For now, I've overriden render_event_response in ApplicationController (note content type and layout => true).

def render_event_response
  page_updates = apotomo_request_processor.process_for({:type => params[:type], :source => params[:source]})
  return render_iframe_updates(page_updates) if params[:apotomo_iframe]
  content_type = (request.format == 'html' ? Mime::HTML : Mime::JS)
  render :text => apotomo_request_processor.render_page_updates(page_updates), :content_type => content_type, :layout => true
end

Something like :content_type => request.format would be great for a start.

SQL injection security hole in the documentation example code

Hi,

Sorry for the hair-splitting, I know that it's just an example, but just in case someone copies it, would you consider changing
items = Tweet.find(:all, :conditions => "text LIKE '%#{param(:term)}%'").
to something like
items = Tweet.find(:all, :conditions => ["text LIKE '%' || ? || '%'", param(:term)]).
or maybe
items = Tweet.where("text LIKE ?", "%#{param(:term)}%").
on http://apotomo.de/peters-guide-1.1/autocomplete.html in line 9 of app/cells/quick_search.rb
because its a security hole.

Cheers,
Bernát

p.s. Apotomo is awsome. It solved nearly all problems I currently had with rails. Many thanks :)

Handle cross-domain on url_for_event

The current implementation rely on apotomo_event_path, which prevents from using the helper on a cross-domain architecture. Just a reminder for myself, really ;)

not working in rails3 using cells3

I get the following error in rails3:
Cells::Cell::Base#request delegated to parent_controller.request, but parent_controller is nil:

my controller:
class DevicesController < ComponentsController
include Apotomo::ControllerMethods
def show
use_widgets do |root|
root << cell(:device, :display, 'my_device', :device => Device.find(params[:id]))
end
end
end

my widget:
class DeviceCell < Apotomo::StatefulWidget
def display
@device = @opts[:device]
render
end
end

Using the same widget twice seems confusing to the routing

I'm new to rails, but it seems as if using the same widget twice is confusing to the routing for apotomo. Here is my example:

I have 2 measures I'm generating a line graph for. I'm using the same widget to display each measure. In my dashboard controller I have:
has_widgets do |root|
root << widget(:monthly_discharge_widget, 'monthly-discharge', :index, :title => 'Monthly Discharges')
root << widget(:scip_measures_widget, 'scip-1-measure', :index,
:title => 'SCIP 1', :measure_name => 'SCIP-Inf-1')
root << widget(:scip_measures_widget, 'scip-9-measure', :index,
:title => 'SCIP 9', :measure_name => 'SCIP-Inf-9')
end

On my dashboard view I have:
#dashboard
.column
= render_widget 'monthly-discharge'
.column
= render_widget 'scip-1-measure'
.column
= render_widget 'scip-9-measure'

When I click a button in the 'scip-9-measure', the display is updated in the 'scip-1-measure' widget. Here is a dump from the rails server:

Started GET "/dashboard/render_event_response?source=scip-9-measure&type=new&utf8=%E2%9C%93&authenticity_token=s%2FSHru1UXcmRAqMMO0xMHwwgB4ZmzJ%2FnLqX%2FpQjQF8g%3D" for 127.0.0.1 at Wed Feb 23 13:35:34 -0700 2011
Processing by DashboardController#render_event_response as */*
Parameters: {"authenticity_token"=>"s/SHru1UXcmRAqMMO0xMHwwgB4ZmzJ/nLqX/pQjQF8g=", "utf8"=>"\342\234\223", "type"=>"new", "source"=>"scip-9-measure"}

invoke on scip-1-measure with :new
scip-1-measure: transition:  to new

Do you have any suggestions on how to fix this?

url_for collision with ActionView

To use the url helpers, I have to add the following in my widget class:

include ActionController::UrlFor

But then if I then call:

url_for_event(:event_name)

I get the following error:

In order to use #url_for, you must include routing helpers explicitly. For instance, `include Rails.application.routes.url_helpers

It seems like Rails intercepts the url_for call. If I comment out the include and comment out all my calls to #link_to, it works.

after_initialize bug

Hi,

I have found a bug in apotomo's hooks.

gère l'affichage des onglets. L'onglet terminer n'apparait que si on passe la session

def onglets

setup!
render 

end

private
def setup!
@Corrige =options[:corrige]
end

This works as expected. But if you try to DRY this, this way :

after_initialize :setup!

def onglets

setup!
render 

end

private
def setup!
@Corrige =options[:corrige]
end

My var, @Corrige is null.

I'm on ruby 1.9.2, rails 3.1.1, apotomo 1.4

I suggest we remove this hook, and update apotomo tuto, with a before_filter.

Cause this works:

before_filter :setup!

def onglets

setup!
render 

end

private
def setup!
@Corrige =options[:corrige]
end

widget_div does not guarantee that HTML IDs are unique

Let's assume that we have the following widgets:

class AWidget < Apotomo::Widget
  has_widgets do |root|
    root << widget(:b, :b1)
    root << widget(:b, :b2)
  end
  ...
end
class BWidget < Apotomo::Widget
  has_widgets do |root|
    root << widget(:c)
  end
  ...
end
class CWidget < Apotomo::Widget
  ...
end

Now I want to render_widget :a. Assuming that each of these classes has a single display action that renders only a widget_div, I get the following HTML structure:

#a
    #b1
        #c
    #b2
        #c

HTML IDs must be unique but this structure contains two DIVs with id c.

Why not make widget names hierarchical so that we could get the following instead?

#a
    #a_b1
        #a_b1_c
    #a_b2
        #a_b2_c

This will change HTML IDs and therefore can break CSS for some people so there should be a configuration option bring back the old behavior.

rescue_from doesn't work

rescue_from doesn't work in a widget.

You can add include ActionController::Rescue to the ApotomoWidget subclass to allow you to call rescue_from but if there is an exception, then it renders as "true" regardless of what the rescue_from handler actually should do.

This would be really cool because it would allow widgets to fail without taking the whole application down. Such as if you had a news widget or something non-vital like that.

The action 'load' could not be found for Widget

I'm trying to make an AjaxWidget class that contains responds_to_event :load and the load action. I then make some other widgets that inherit from that AjaxWidget. Then when I try to render the widgets load action I get:

The action 'load' could not be found for Widget

Nesting/namspecing is not applied in generator for views

According the tutorial I did:

apotomo_bar$ rails g apotomo:widget Twitter::Form display -e haml
create app/widgets/twitter/form_widget.rb
invoke haml
create app/widgets/form/display.html.haml
invoke test_unit
create test/widgets/form_widget_test.rb

Expected:
....
create app/widgets/twitter/form/display.html.haml

Implement Mountable Widgets

Feature: Implement Mountable Widgets

I think is already working for Cells. Let make it work in Apotomo too :)

Routing:

match “/posts” => Cell::Rack.new(:posts, :show) 

In the case of exception...

In development mode in case of any exception (related to cells code, like no template found) it takes a lot of time while the trace appears in log and is rendered in browser.

Apotomo 1.1.4 and Rails 3.2.2 don't play nice

I created a project with Rails 3.2.2 and just attempted to integrate Apotomo 1.1.4. It's erroring when a widget is called.

ArgumentError in Searches#show

Showing /Users/cdean/Source/fancypants/app/views/searches/show.html.haml where line #12 raised:

wrong number of arguments(2 for 0)
Extracted source (around line #12):

9:     = render :partial => 'results'
10:   #output
11:   %section#column_right
12:     = render_widget :debug
13: %footer

I get this stack trace when a widget -- even a simple one with no logic -- is included.

actionpack (3.2.2) lib/abstract_controller/layouts.rb:359:in `initialize'
actionpack (3.2.2) lib/abstract_controller/layouts.rb:359:in `initialize'
actionpack (3.2.2) lib/action_dispatch/routing/url_for.rb:103:in `initialize'
apotomo (1.1.4) lib/apotomo/widget.rb:94:in `initialize'
apotomo (1.1.4) lib/apotomo/request_processor.rb:15:in `new'
apotomo (1.1.4) lib/apotomo/request_processor.rb:15:in `initialize'
apotomo (1.1.4) lib/apotomo/rails/controller_methods.rb:53:in `new'
apotomo (1.1.4) lib/apotomo/rails/controller_methods.rb:53:in `apotomo_request_processor'
apotomo (1.1.4) lib/apotomo/rails/controller_methods.rb:61:in `render_widget'
apotomo (1.1.4) lib/apotomo/rails/controller_methods.rb:15:in `render_widget'
app/views/searches/show.html.haml:12:in `_app_views_searches_show_html_haml___3256582029931032646_2172902420'
actionpack (3.2.2) lib/action_view/template.rb:143:in `block in render'
activesupport (3.2.2) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.2) lib/action_view/template.rb:141:in `render'
actionpack (3.2.2) lib/action_view/renderer/template_renderer.rb:42:in `block (2 levels) in render_template'
actionpack (3.2.2) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.2) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.2) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.2) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.2) lib/action_view/renderer/template_renderer.rb:41:in `block in render_template'
actionpack (3.2.2) lib/action_view/renderer/template_renderer.rb:49:in `render_with_layout'
actionpack (3.2.2) lib/action_view/renderer/template_renderer.rb:40:in `render_template'
actionpack (3.2.2) lib/action_view/renderer/template_renderer.rb:13:in `render'
actionpack (3.2.2) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.2) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.2) lib/abstract_controller/rendering.rb:109:in `_render_template'
actionpack (3.2.2) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.2) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.2) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.2) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.2) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.2) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.2) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.2) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/Users/cdean/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.2) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.2) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.2) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.2) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.2) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.2) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.2) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.2) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.2) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.2) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.2) lib/active_support/callbacks.rb:414:in `_run__1428161299751401196__process_action__2897576359404743956__callbacks'
activesupport (3.2.2) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.2) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.2) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.2) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.2) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.2) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.2) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.2) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.2) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.2) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.2) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.2) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.2) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.2) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.2) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.2) lib/action_dispatch/routing/route_set.rb:67:in `call'
actionpack (3.2.2) lib/action_dispatch/routing/route_set.rb:67:in `dispatch'
actionpack (3.2.2) lib/action_dispatch/routing/route_set.rb:30:in `call'
journey (1.0.3) lib/journey/router.rb:68:in `block in call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.2) lib/action_dispatch/routing/route_set.rb:594:in `call'
sass (3.1.15) lib/sass/plugin/rack.rb:54:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.2) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.2) lib/active_support/callbacks.rb:405:in `_run__1797043087140896197__call__4153845417483332991__callbacks'
activesupport (3.2.2) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.2) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.2) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.2) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.2) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.2) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.2) lib/action_dispatch/middleware/static.rb:61:in `call'
railties (3.2.2) lib/rails/engine.rb:479:in `call'
railties (3.2.2) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.2) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/Users/cdean/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/cdean/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/cdean/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

I verified it by installing from scratch a new Rails 3.2.2 project with Apotomo 1.1.4, generating a scaffold, creating a widget using the generator, and then rendering that widget from within the index view of the scaffold. It errors on 3.2.2.

HOWEVER

If I switch back to 3.2.1 or go to 3.2.3, it works.

Event dispatching bug

When page contains two widget of one class and responds to event with option :passing, then only first widget in widget collection processing event. File lib/apotomo/widget/event_methods.rb contains method after_initialize

      if target_id = options[:passing]
         target = root.find_widget(target_id)
         options[:on] ||= widget_id
      end

and option must be copy, like this

      if target_id = options[:passing]
         options = options.copy
         target = root.find_widget(target_id)
         options[:on] ||= widget_id
      end

because options :on add to widget class (not to instance) and next widget on page will has id of the first widget

Apotomo breaks simple_navigation plugin

Hi,

I tried to play with apotomo by trying to create a widget for my application but when I included apotomo in my controller my view tests failed with the exception that 'controller' is protected method. Here is the complete stacktrace:

protected method `controller' called for #ArticleItemsController:0x7ffbc6e7a148

Extracted source (around line #27):

24: = render :partial => "shared/user_status"
25:
26: #navigation
27: = render_navigation
28:
29: = yield(:featured_content)
30:

RAILS_ROOT: /home/vortex/######/######
Application Trace | Framework Trace | Full Trace

/var/lib/gems/1.8/gems/simple-navigation-2.4.1/lib/simple_navigation.rb:121:in extract_controller_from' /var/lib/gems/1.8/gems/simple-navigation-2.4.1/lib/simple_navigation.rb:48:inset_template_from'
/var/lib/gems/1.8/gems/simple-navigation-2.4.1/lib/simple_navigation/helpers.rb:38:in render_navigation' (eval):2:insend'
(eval):2:in render_navigation' /home/vortex/dev/mkmetal/app/views/layouts/application.html.haml:27:in_run_haml_app47views47layouts47application46html46haml'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:in send' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:inrender_without_trace_View_path_r_2_Rendering'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:306:in with_template' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:30:inrender_without_trace_View_path_r_2_Rendering'
/var/lib/gems/1.8/gems/newrelic_rpm-2.11.1/lib/new_relic/agent/method_tracer.rb:319:in render' /var/lib/gems/1.8/gems/newrelic_rpm-2.11.1/lib/new_relic/agent/method_tracer.rb:141:intrace_execution_scoped'
/var/lib/gems/1.8/gems/newrelic_rpm-2.11.1/lib/new_relic/agent/method_tracer.rb:314:in render' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_view/template.rb:205:inrender_template'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:265:in render_without_haml' /var/lib/gems/1.8/gems/haml-2.2.22/lib/haml/helpers/action_view_mods.rb:13:inrender'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:352:in _render_with_layout' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:262:inrender_without_haml'
/var/lib/gems/1.8/gems/haml-2.2.22/lib/haml/helpers/action_view_mods.rb:13:in render' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1250:inrender_for_file'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:945:in render_without_benchmark' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:inrender'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in ms' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:inms'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in render' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1326:indefault_render'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1332:in perform_action_without_filters' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:incall_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in perform_action_without_benchmark' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue'
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in ms' /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:inms'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:inperform_action_without_flash'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in perform_action_without_newrelic_trace' /var/lib/gems/1.8/gems/newrelic_rpm-2.11.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:253:inperform_action'
/var/lib/gems/1.8/gems/newrelic_rpm-2.11.1/lib/new_relic/agent/method_tracer.rb:141:in trace_execution_scoped' /var/lib/gems/1.8/gems/newrelic_rpm-2.11.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:246:inperform_action'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in send' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:inprocess_without_filters'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in sass_old_process' /var/lib/gems/1.8/gems/haml-2.2.22/lib/sass/plugin/rails.rb:20:inprocess_without_compass'
/var/lib/gems/1.8/gems/compass-0.8.17/lib/compass/app_integration/rails/action_controller.rb:7:in process' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:inprocess'
/var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in call' /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:incall'

If I remove the simple_navigation rendering everything is ok. Is there a workaround around this?

Thanks.

Errors on a clean install

I did a git clone, bundle, then rake test and got these errors:

  1) Error:
test: A Rails controller invoking #has_widgets should inherit has_widgets blocks to sub-controllers. (ControllerMethodsTest):
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<<


  2) Error:
test: A controller not including ControllerMethods explicitely should respond to .has_widgets only. (IncludingApotomoSupportTest):
NoMethodError: undefined method `assert_not_respond_to' for #<IncludingApotomoSupportTest:0x9525d10>


  3) Failure:
test: ActionController should pass the event with all params data as state-args. (RailsIntegrationTest)
    []:
<"{\"source\"=>\"mum\", \"type\"=>:squeak, \"pitch\"=>:high, \"controller\"=>\"barn\", \"action\"=>\"render_event_response\"}"> expected but was
<"pitchhighactionrender_event_responsetypesqueakcontrollerbarnsourcemum">.

  4) Error:
test: TestCase responding to #root should memorize root. (TestCaseTest):
NameError: uncaught throw `invalid_test'


  5) Error:
test: TestCase responding to #root should raise an error if no has_widgets block given. (TestCaseTest):
NameError: uncaught throw `invalid_test'


  6) Error:
test: TestCase responding to #root should respond to #assert_select. (TestCaseTest):
NameError: uncaught throw `invalid_test'


  7) Error:
test: TestCase responding to #root should respond to #render_widget. (TestCaseTest):
NameError: uncaught throw `invalid_test'


  8) Error:
test: TestCase responding to #root should respond to #root. (TestCaseTest):
NameError: uncaught throw `invalid_test'


  9) Error:
test: TestCase responding to #root using events should provide options from #trigger to the widget. (TestCaseTest):
NameError: uncaught throw `invalid_test'


 10) Error:
test: TestCase responding to #root using events should respond to #assert_response. (TestCaseTest):
NameError: uncaught throw `invalid_test'


 11) Error:
test: TestCase responding to #root using events should respond to #trigger. (TestCaseTest):
NameError: uncaught throw `invalid_test'


 12) Error:
test: TestCase responding to parent_controller should provide a test controller. (TestCaseTest):
NameError: uncaught throw `invalid_test'


 13) Error:
test: TestCase responding to parent_controller should respond to #controller_path. (TestCaseTest):
NameError: uncaught throw `invalid_test'


153 tests, 223 assertions, 1 failures, 12 errors
rake aborted!
Command failed with status (1): [/home/ramon/.rvm/rubies/ree-1.8.7-2011.03/...]
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/file_utils.rb:53:in `create_shell_runner'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `call'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `sh'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `sh'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/file_utils.rb:80:in `ruby'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `ruby'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/testtask.rb:99:in `define'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:57:in `verbose'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/testtask.rb:98:in `define'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/home/ramon/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/gems/rake-0.9.2/bin/rake:32
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/bin/rake:19:in `load'
/home/ramon/.rvm/gems/ree-1.8.7-2011.03@apotomo/bin/rake:19

apotomo conflicts with jQuery.noConflict

jQuery.noConflict tells jQuery to not overwrite $() so developers can use prototype along side jQuery.
apotomo generates $(selector).replaceWith() when using jQuery

Helpers are not properly reloaded in development mode

This is going to be hard!

class TwitterWidget < BaseWidget
  def display
    render
  end
end

class BaseWidget < Apotomo::Widget
  helper do
    def widget_div(options={}, &block)
      options[:class] = Array.wrap( options[:class] )
      options[:class] << Range.new(:m, :z).to_a.sample
      super 
    end
  end
end

With every new request in development mode the widget div has 1 more letter added to its class. So the first request generates something like:

<div class="n" id="twitter"> 
  <h1> 
    TwitterWidget#display
  </h1> 
</div> 

and next one generates :

<div class="n x" id="twitter"> 
  <h1> 
    TwitterWidget#display
  </h1> 
</div> 

I think you can only see the bug when using super in helper because otherwise the definition from last code reload is used but under the hood there are still previous definitions remembered! Moving the method to SomeHelper and using helper SomeHelper in widget definition does not help either. Same thing happens.

ActiveAdmin and Apotomo cause double submit - Post events

If you have ActiveAdmin and Apotomo installed in the same rails application, the submit_tag buttons are causing a double submit, thus you see 2 simultaneous post events every time you hit the submit button. Running rails 3.1.0. Apotomo 1.1.0 and 1.2.0 both exhibit the behavior.

Apotomo doesn't look for views in Engines

I've got a problem when using Apotomo in conjunction with Engines:

Missing template usage/display with {:handlers=>[:erb, :builder], 
:formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, 
:yaml, :multipart_form, :url_encoded_form, :json, :docx, :pptx, 
:xlsx], :locale=>[:"pt-BR", :"pt-BR"]}. Searched in: 
  * "/Users/lunks/Code/tarifador/app/widgets" 

Looks to me that Apotomo/Cells doesn't respect engines when looking for
views. app/widgets/usage_widget.rb works if in an Engine, though.

PS: This was already posted here, but this looks like an issue, so I'm posting it here. Sorry for duplcating stuff around, Nick. ;)

`rails` command broken after installing Apotomo

I'm running through the introduction guide (http://apotomo.de/peters-guide-1.1/introduction.html). However, invoking rails generate jquery:install generates the following error:

/Users/bencallaway/Projects/apotomo/config/application.rb:10:in `<module:Apotomo>': uninitialized constant Apotomo::Rails::Application (NameError)
  from /Users/bencallaway/Projects/apotomo/config/application.rb:9:in `<top (required)>'
  from /Users/bencallaway/.rvm/gems/ruby-1.9.2-p180@apotomo/gems/railties-3.0.8/lib/rails/commands.rb:15:in `require'
  from /Users/bencallaway/.rvm/gems/ruby-1.9.2-p180@apotomo/gems/railties-3.0.8/lib/rails/commands.rb:15:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

I'm running apotomo v1.1.1

Inherited widget does not contain :load action method

class BaseWidget < Apotomo::Widget
  responds_to_event :load,   :with => :load
  responds_to_event :fetch,  :with => :fetch

  def display
    render
  end
  def load
    replace :state => :display
  end
  def fetch
    replace :state => :display
  end
end

class TwitterWidget < BaseWidget
  def display
    render
  end
end

twitter/display.html.erb:

<%= widget_div do %>
<h1>
  TwitterWidget#display
</h1>

<p>
  Find me in app/widgets/twitter/display.html.erb
</p>

<%= link_to "Load again",  url_for_event(:load),  :method => :post, :remote => true %>
<%= link_to "Fetch again", url_for_event(:fetch), :method => :post, :remote => true  %>

<% end %>

Pressing "Fetch again" works fine:

Started POST "/bubbles/render_event_response?source=twitter&type=fetch" for 127.0.0.1 at 2011-07-04 10:09:40 +0200
  Processing by BubblesController#render_event_response as JS
  Parameters: {"source"=>"twitter", "type"=>"fetch"}
Rendered app/widgets/twitter/display.html.erb (1.1ms)
Rendered text template (0.0ms)
Rendered text template (0.0ms)
Completed 200 OK in 22ms (Views: 0.6ms | ActiveRecord: 0.0ms)

Pressing "Load again" does not work because of an error:

Started POST "/bubbles/render_event_response?source=twitter&type=load" for 127.0.0.1 at 2011-07-04 10:09:39 +0200
  Processing by BubblesController#render_event_response as JS
  Parameters: {"source"=>"twitter", "type"=>"load"}
Completed   in 16ms

AbstractController::ActionNotFound (The action 'load' could not be found for TwitterWidget):

Rendered /home/rupert/.rvm/gems/ruby-1.9.2-p180-fastrequire/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/unknown_action.erb within rescues/layout (0.7ms)

I went deeper and deeper into code to find out that:

BaseWidget.action_methods.include?('load')  => true 
TwitterWidget.action_methods.include?('load') => false 

So somehow the simple act of inheriting TwitterWidget from BaseWidget removes load method from action_methods. However it only happens for load method. fetch works fine. Is load somehow special?

Cells v3.7.0 issue

Cells v3.7.0 causes error:

"wrong number of arguments (2 for 1)"

cells (3.7.0) lib/cell/rails.rb:49:in initialize' apotomo (1.1.4) lib/apotomo/widget.rb:94:ininitialize'
apotomo (1.1.4) lib/apotomo/request_processor.rb:15:in new' apotomo (1.1.4) lib/apotomo/request_processor.rb:15:ininitialize'
apotomo (1.1.4) lib/apotomo/rails/controller_methods.rb:53:in new' apotomo (1.1.4) lib/apotomo/rails/controller_methods.rb:53:inapotomo_request_processor'
apotomo (1.1.4) lib/apotomo/rails/controller_methods.rb:61:in render_widget' apotomo (1.1.4) lib/apotomo/rails/controller_methods.rb:15:inrender_widget'

Possible Fix:
Set gemspec cells = 3.6.7 instead of cells >= 3.6.7

#use_widgets does not work with Rails3

def edit
  use_widgets do |root|
     root << widget(:my_widget, :me)
  end
  ...
end

RuntimeError in admin/myController#edit

Couldn't render non-existent widget me

Pay your debt, Nick Sutterer!

Hi Nick,

I want my money back for the project you did not finish! As you agreed - you wanted to stop the project and to pay back some of the money I gave you believing your words and believing in your skills. Don’t deceive me again -
you owe me more than 1500 Euro that you offered to pay back in December 2009. So far I received no payments - therefore I want to remind you to put your money where your mouth is.

Be a man and pay your debt.

Best regards,

Your creditor and former sponsor

render :json

When calling render :json => @object in a Apotomo::Widget it looks for a template of format .json instead of calling .to_json on the object and setting the content_type to "application/json" like a regular controller would do.

url_for_event - wrong number of arguments (1 for 2)

hi,

i m getting wrong number of arguments error when i try to render a widget state within a jquery ui dialog via ajax like this

   %a.link(href="#") open
      :javascript
        $(".link").click(function() {
          $.get('#{url_for_event(:list)}', function(data) {
           $("#dialogEleven").html(data).dialog("open");
         });
        });

in the home#index controller

class HomeController < ApplicationController
  include Apotomo::Rails::ControllerMethods
  #skip_before_filter :require_login

  has_widgets do |root|
    root << widget(:products)
  end

  def index
  end

and the widget is

class ProductsWidget < Apotomo::Widget
  responds_to_event :list, :update_list

  helper ApplicationHelper

  def display(opts)
    @product = VProduct.find(opts[:id]) if opts[:ptype] == "V"
    return render_state :not_found if !@product
    render
  end

  def list(opts)
    @products = VProduct.get_v_products(opts[:search], opts[:page])
    render
  end

  def update_list(opts)
    @search = opts[:search]
    @products = VProduct.get_v_products(opts[:search], opts[:page])
    update :state => :list
  end

  def not_found
  end

end

i m using rails 3.1.1

Not working with Rails 3.0.1/3.0.0

a pristine rails 3 app with:
rails generate apotomo:widget CommentsWidget display process

class HomeController < ApplicationController
 include Apotomo::Rails::ControllerMethods

 has_widgets do |root|
   root << widget('comments_widget', 'post-comments', :display)
 end
end

and
<%= render_widget 'post-comments' %> in the view

Error:
wrong number of arguments (1 for 0)
Extracted source (around line #1):

1: <%= render_widget 'post-comments' %>

backtrace:

cells (3.4.2) lib/cell/rails.rb:32:in process' cells (3.4.2) lib/cell/rails.rb:32:inrender_state'
cells (3.4.2) lib/cell/caching.rb:95:in render_state' apotomo (1.0.0.beta2) lib/apotomo/widget.rb:122:ininvoke'
apotomo (1.0.0.beta2) lib/apotomo/request_processor.rb:78:in render_widget_for' apotomo (1.0.0.beta2) lib/apotomo/rails/controller_methods.rb:92:inrender_widget'
apotomo (1.0.0.beta2) lib/apotomo/rails/view_methods.rb:4:in __send__' apotomo (1.0.0.beta2) lib/apotomo/rails/view_methods.rb:4:inrender_widget'
app/views/home/index.html.erb:1:in `_app_views_home_index_html_erb__218612812_22451880_0'

Caching

Hi again,
Is there any reason that apotomo's cache method has different parameters than that of cells?

I try to pass both proc and options as it is possible in cell and it doesn't work for apotomo.


cache :cached_state, Proc.new { {:version => 0} }, :expires_in => 10.minutes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.