pakyow 0.9.1 binding problem

16 views
Skip to first unread message

ahmet

unread,
Feb 22, 2015, 11:35:04 AM2/22/15
to pak...@googlegroups.com
hi eveyone,

i am having problem with this code pieces.

routes.rb

-------------


Pakyow::App.routes do


  

 get('/') {

        

        view.scope(:post).apply(Post.all)

  }

 

  restful :post, '/posts' do

    get 'show' do

      p 'show route'

    end

    

  end


end


bindings.rb

---------------

Pakyow::App.bindings do

  # define bindings here

  

   scope(:post) {

       

        binding(:link) {

             {

                content: bindable[:title], href: router.group(:posts).path(:show, bindable)

             }

        }

      }

      

end



it says:

^^^^-------

Pakyow found something wrong.

The error originated on line 37 of '/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb' and generated the following stack trace:

Could not find route 'show'

/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:37:in `route'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/route_lookup.rb:23:in `get_named_route'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/route_lookup.rb:10:in `path'
/Users/ahmet/pakyoworks/091-1/app/lib/bindings.rb:8:in `block (3 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/binder.rb:58:in `instance_exec'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/binder.rb:58:in `value_for_scoped_prop'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view.rb:308:in `block (2 levels) in bind_data_to_scope'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view.rb:299:in `catch'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view.rb:299:in `block in bind_data_to_scope'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view.rb:298:in `each'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view.rb:298:in `bind_data_to_scope'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view.rb:228:in `bind'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:218:in `block in bind'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:137:in `call'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:137:in `block in for'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:11:in `block in each'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:11:in `each'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:11:in `each'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:130:in `each_with_index'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:130:in `for'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:217:in `bind'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_collection.rb:253:in `apply'
/Library/Ruby/Gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_context.rb:27:in `block (2 levels) in <class:ViewContext>'
/Users/ahmet/pakyoworks/091-1/app/lib/routes.rb:7:in `block (2 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:102:in `instance_exec'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:102:in `block in call_fns'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:102:in `each'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:102:in `call_fns'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:140:in `block in trampoline'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:139:in `catch'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:139:in `trampoline'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:46:in `perform'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/app.rb:245:in `block in process'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/app.rb:242:in `catch'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/app.rb:242:in `process'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/app.rb:223:in `call'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/reloader.rb:10:in `call'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/logger.rb:118:in `block in call'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/logger.rb:129:in `time'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/logger.rb:116:in `call'
/Library/Ruby/Gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/static.rb:20:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.0/lib/rack/methodoverride.rb:22:in `call'
/Library/Ruby/Gems/2.0.0/gems/rack-1.6.0/lib/rack/builder.rb:153:in `call'
/Library/Ruby/Gems/2.0.0/gems/puma-2.11.1/lib/puma/server.rb:507:in `handle_request'
/Library/Ruby/Gems/2.0.0/gems/puma-2.11.1/lib/puma/server.rb:375:in `process_client'
/Library/Ruby/Gems/2.0.0/gems/puma-2.11.1/lib/puma/server.rb:262:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/puma-2.11.1/lib/puma/thread_pool.rb:104:in `call'
/Library/Ruby/Gems/2.0.0/gems/puma-2.11.1/lib/puma/thread_pool.rb:104:in `block in spawn_thread'



Bryan Powell

unread,
Feb 23, 2015, 9:10:40 AM2/23/15
to pak...@googlegroups.com
Hello Ahmet,

Rather than:

 get 'show' do ...

Just do this:

show do ...

Bryan P.

--
You received this message because you are subscribed to the Google Groups "Pakyow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pakyow+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ahmet

unread,
Feb 23, 2015, 10:03:55 AM2/23/15
to pak...@googlegroups.com
thanks i changed it but problem not there,
when I write this url http://localhost:3000, the error comes.
when I write http://localhost:3000/posts/ or http://localhost:3000/posts/show
it is working without error.
i think problem is coming from here:

content: bindable[:title], href: router.group(:posts).path(:show, bindable)

and what is this meaning : /Users/ahmet/pakyoworks/091-1/app/lib/bindings.rb:8:in `block (3 levels) in <top (required)>'
what is the required thing?

bryanp

unread,
Feb 23, 2015, 12:37:34 PM2/23/15
to pak...@googlegroups.com
The problem here is that Pakyow can't find a `show` route in the `posts` group. Making the change I suggested will define that route, so the route lookup works.

Does that still not fix the problem? If not, can you Gist your updated routes?

Bryan P.
To unsubscribe from this group and stop receiving emails from it, send an email to pakyow+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Pakyow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pakyow+unsubscribe@googlegroups.com.

Ahmet

unread,
Feb 23, 2015, 1:06:56 PM2/23/15
to pak...@googlegroups.com
sorry i did not understand  `show` route in the `posts` group. 
this is not posts group?

restful :post'/posts' do

    get 'show' do

      'show route'

    end   

  end

please explain about the routing and binding about.

for example; i have index page and it contains all posts and i want to click one post and i want to she it on show page. how can i do that? please provide one sample. because that is my problem.



To unsubscribe from this group and stop receiving emails from it, send an email to pakyow+un...@googlegroups.com.

bryanp

unread,
Feb 24, 2015, 2:51:10 PM2/24/15
to pak...@googlegroups.com
Yes, that's the posts group, but it's looking for a route named `show`. You could do this one of two ways:

restful :post, '/posts' do
  get :show, 'show' do
    p 'show route'
  end
end

OR:

restful :post, '/posts' do
  show do
    p 'show route'
  end
end

The second one is the recommended way to do it.

Bryan P.
Reply all
Reply to author
Forward
0 new messages