[Rails] Re: ROUTING ERROR" "No route matches [POST] "/signup - addendum to previous post

2016-07-22 Thread Howard Gilbert


On Thursday, 21 July 2016 16:36:24 UTC+1, Howard Gilbert wrote:
>
> Where I have said pressing "Signup" I should have said pressing "Signup" 
> filling in the form and then pressing "Create my Account" 
>

The original post, to which this adds, seems to not have appeared.  So this 
post should be deleted.  I can't find how to do that. 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0126f235-a566-4df8-ba58-f5909aa306cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] Re: ROUTING ERROR" "No route matches [POST] "/signup - addendum to previous post

2016-07-22 Thread Colin Law
On 22 July 2016 at 15:06, Howard Gilbert  wrote:
>
>
> On Thursday, 21 July 2016 16:36:24 UTC+1, Howard Gilbert wrote:
>>
>> Where I have said pressing "Signup" I should have said pressing "Signup"
>> filling in the form and then pressing "Create my Account"
>
>
> The original post, to which this adds, seems to not have appeared.  So this
> post should be deleted.  I can't find how to do that.

You can't, this is a mailing list not a forum.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuNDMvor7vXYA9efGCvULBet2DFwD9_UGX-_EQqqULH%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing error

2016-05-12 Thread Neo Elit
Your PapTagsController should be inside monitor module. I don't how it 
worked in local server without that.

file: /app/controllers/monitor/pap_tags_controller.rb

module Monitor
  class PapTagsController < ApplicationController 
... 
  end
end

On Thursday, May 12, 2016 at 6:19:23 PM UTC+5:30, Ruby-Forum.com User wrote:
>
> Hi all, 
>
> for first sorry for my english. 
>
> I've a Rails app with a namespaced route that works fine on localhost 
> but does not work on remote Server. 
>
> This is my error: 
>
> ActionController::RoutingError (uninitialized constant 
> Monitor::PapTagsController): 
>
> My routes.rb 
>
> namespace :monitor do 
> resources :pap_tags do 
>   resources :pap_tag_rules 
> end 
>   end 
>
> file is: pap_tags_controller.rb 
>
> class PapTagsController < ApplicationController 
> ... 
> end 
>
> It's very strange, can you help me? 
>
> thanks. 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/67cccdc6-c907-47d5-aa0d-c6e2748e8f38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Charles Hoff
I felt this one covered alot of important things, Im using it as a 
baseline to build out something custom that I am doing (or at least 
trying).

https://www.youtube.com/watch?v=AMai9EZesXY





Johnny Hu wrote in post #1181710:
> The snake case in your controller file name should be fine. What
> tutorial are you using by the way? Is it online?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f73906c30fb39b4980b854a32de59be8%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Johnny Hu
The snake case in your controller file name should be fine. What tutorial are 
you using by the way? Is it online? 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5cad23f1-c8be-45a3-9f5d-2ef768172bcb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Charles Hoff
Thats what it was, had to change both resources and root to read
"tow_companies".

Appreciate your help and help, thanks guys!

Walter Davis wrote in post #1181708:
> Yes, you have to have tow_companies, not towcompanies in the resources:
> line.
>
> Read up on how Rails ties everything together with CamelCasing ->
> snake_casing conventions.
>
> Walter

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/42ff9c843e2fc95fa0c3ac731af42cb3%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Charles Hoff
Tried restarting it, same thing, also tried the two things you mentioned 
and get the same result. No idea why.

I posted the controller above like you requested, does it matter that 
the actual controller file name is "tow_companies_controller.rb"? NOt 
sure if the underscores affect anything.


Any other ideas???

I appreciate your help!



Johnny Hu wrote in post #1181706:
> Secondarily, did you have a web server running already? If so, maybe try
> restarting it?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/4faa530cb552d1931b0e78b7273fca0b%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Johnny Hu
Secondarily, did you have a web server running already? If so, maybe try 
restarting it? 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/047ec2ce-658f-40b7-bdec-ba0b358c78ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Johnny Hu
This might not affect anything but can you see if the error happens if you 
remove "resources :towcompanies", or reorder so the line with the root is 
first? 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/34c91b76-1f43-40ad-8cbd-dcc8b38ed79b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Charles Hoff
class TowCompaniesController < ApplicationController
  def index
  end


end





Johnny Hu wrote in post #1181703:
> Can you post the contents from the controller in question?
>
> On Saturday, February 27, 2016 at 10:37:32 AM UTC-8, Ruby-Forum.com User

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/5679da83f37e509520cd5bde73ee088c%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Johnny Hu
Can you post the contents from the controller in question?

On Saturday, February 27, 2016 at 10:37:32 AM UTC-8, Ruby-Forum.com User 
wrote:
>
> Did that, still get the same error. 
>
>
> Walter Davis wrote in post #1181701: 
> > Sorry, autocorrect fail. The thing missing in yours was the to: key, not 
> > the value. Just add the to: part to what you had. 
> > 
> > Walter 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/53e3a4be-69a3-425c-b21e-66d11a76bfb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Charles Hoff
Did that, still get the same error.


Walter Davis wrote in post #1181701:
> Sorry, autocorrect fail. The thing missing in yours was the to: key, not
> the value. Just add the to: part to what you had.
>
> Walter

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9598a98a59e732df92de3f23bc1cbe96%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing Error uninitialized constant TowcompaniesController

2016-02-27 Thread Charles Hoff
Appreciate your help,

root to: 'towcompanies#index'

(Still generates the same error)

root to: 'tow companies#index'

('tow companies' is not a supported controller name. )


Anything else I could be missing?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/564328c3590d3bf890d57b56793f1109%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Routing error: no route matches contoller works. Route exists though

2012-06-05 Thread Martyn W.
Martyn W. wrote in post #1063175:
> I have a fairly straight forward rails app, version 3.2. When I try to
> create a Work instance, with deliberately invalid fields from a form, I
> get a routing error:
>
> No route matches {:controller=>"works"}
>
> This does not happen when I try the same test with an update on a Work
> instance. After an attempted update I get the edit.html.erb page
> rendered with the invalid fields highlighted.
>
> I dont understand why after failing the save in the controller and
> trying to render "new" it would give me a route matching error. Any
> ideas?
>
> Attached are my model, controller and routes.rb

So, it was a link in the new.htnl.erb file referencing a list of works 
through the associated workticket. I guess I need to reassign the 
workticket parameter for the failed save render.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Routing error: no route matches contoller works. Route exists though

2012-06-05 Thread Jeremy Walker
On 5 June 2012 18:08, Martyn W.  wrote:

> Hassan Schroeder wrote in post #1063180:
> > On Tue, Jun 5, 2012 at 9:56 AM, Martyn W.  wrote:
> >
> >> I dont understand why after failing the save in the controller and
> >> trying to render "new" it would give me a route matching error. Any
> >> ideas?
> >
> > Yes - look at the log for that request :-)
> >
> > --
> > Hassan Schroeder  hassan.schroe...@gmail.com
> > http://about.me/hassanschroeder
> > twitter: @hassan
>
> Hassan,
>
> I don't see anything in the logs that explains the routing error. The
> controller is redirecting the failed save to the "new" view using
> render. There shouldn't be any routing issues here.
>
> Here is the log entry for this action: (sanitized a bit to read)
>
> Started POST "/works" for 127.0.0.1 at 2012-06-05 12:04:18 -0500
> Processing by WorksController#create as HTML
> Parameters: {"utf8"=>"?",
> "authenticity_token"=>"vrAsdpq9G04to6SgW5HNvb5NWcN8rPCy01ZwKK95lhM=",
> "work"=>{"start(1i)"=>"2012", "start(2i)"=>"6", "start(3i)"=>"5",
> "start(4i)"=>"17", "start(5i)"=>"04", "end(1i)"=>"2012", "end(2i)"=>"6",
> "end(3i)"=>"5", "end(4i)"=>"17", "end(5i)"=>"04", "good"=>"", "bad"=>"",
> "operation"=>"1", "work_ticket_id"=>"8", "shift_id"=>"1",
> "operator_id"=>"1", "machine_id"=>"1"}, "commit"=>"Create Work"}
> In start_must_be_before_end_time
> In start_must_be_before_end_time
> In start_must_be_before_end_time
> In start_must_be_before_end_time
> @work.save: false
> @work.errors.count: 2
>
>  Rendered works/_form.html.erb (62.5ms)
>  Rendered works/new.html.erb within layouts/application (62.5ms)
> Completed 500 Internal Server Error in 156ms
>
> ActionController::RoutingError (No route matches
> {:controller=>"works"}):
>  app/views/works/new.html.erb:5:in
>

So the error is on on line 5 of your new.html. What does that line look
like?


> `_app_views_works_new_html_erb__545664482_19220532'
>  app/controllers/works_controller.rb:136:in `block (2 levels) in
> create'
>  app/controllers/works_controller.rb:127:in `create'
>
>
>  Rendered
>
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb
> within rescues/layout (0.0ms)
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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 rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error: no route matches contoller works. Route exists though

2012-06-05 Thread Martyn W.
Hassan Schroeder wrote in post #1063180:
> On Tue, Jun 5, 2012 at 9:56 AM, Martyn W.  wrote:
>
>> I dont understand why after failing the save in the controller and
>> trying to render "new" it would give me a route matching error. Any
>> ideas?
>
> Yes - look at the log for that request :-)
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> http://about.me/hassanschroeder
> twitter: @hassan

Hassan,

I don't see anything in the logs that explains the routing error. The 
controller is redirecting the failed save to the "new" view using 
render. There shouldn't be any routing issues here.

Here is the log entry for this action: (sanitized a bit to read)

Started POST "/works" for 127.0.0.1 at 2012-06-05 12:04:18 -0500
Processing by WorksController#create as HTML
Parameters: {"utf8"=>"?", 
"authenticity_token"=>"vrAsdpq9G04to6SgW5HNvb5NWcN8rPCy01ZwKK95lhM=", 
"work"=>{"start(1i)"=>"2012", "start(2i)"=>"6", "start(3i)"=>"5", 
"start(4i)"=>"17", "start(5i)"=>"04", "end(1i)"=>"2012", "end(2i)"=>"6", 
"end(3i)"=>"5", "end(4i)"=>"17", "end(5i)"=>"04", "good"=>"", "bad"=>"", 
"operation"=>"1", "work_ticket_id"=>"8", "shift_id"=>"1", 
"operator_id"=>"1", "machine_id"=>"1"}, "commit"=>"Create Work"}
In start_must_be_before_end_time
In start_must_be_before_end_time
In start_must_be_before_end_time
In start_must_be_before_end_time
@work.save: false
@work.errors.count: 2

  Rendered works/_form.html.erb (62.5ms)
  Rendered works/new.html.erb within layouts/application (62.5ms)
Completed 500 Internal Server Error in 156ms

ActionController::RoutingError (No route matches 
{:controller=>"works"}):
  app/views/works/new.html.erb:5:in 
`_app_views_works_new_html_erb__545664482_19220532'
  app/controllers/works_controller.rb:136:in `block (2 levels) in 
create'
  app/controllers/works_controller.rb:127:in `create'


  Rendered 
c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb
 
within rescues/layout (0.0ms)

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error (route not found) but only for destroy action.

2011-08-23 Thread Frederick Cheung

On Aug 23, 1:49 am, 7stud --  wrote:
>
> > or polymorphic_path(item_to_delete) (which is what gets called if you
> > do button_to('delete', item_to_delete, :method => 'delete') )
>
> So what you are saying is that rails automatically does all that for you
> under the hood--if you specify a model object for the path in
> button_to()?

Yes.

Fred

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error (route not found) but only for destroy action.

2011-08-22 Thread 7stud --
Frederick Cheung wrote in post #1017860:
> On Aug 22, 1:28pm, 7stud --  wrote:
>
>> Once you have a way to execute a method when you have the name of the
>> method as a string, you can get creative:
>>
>> model = item_to_destroy.class.to_s.downcase
>>
>> self.send("#{model}_path", item_to_delete)
>>
>
> or polymorphic_path(item_to_delete) (which is what gets called if you
> do button_to('delete', item_to_delete, :method => 'delete') )
>

So what you are saying is that rails automatically does all that for you 
under the hood--if you specify a model object for the path in 
button_to()?

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error (route not found) but only for destroy action.

2011-08-22 Thread Frederick Cheung


On Aug 22, 1:28 pm, 7stud --  wrote:

> Once you have a way to execute a method when you have the name of the
> method as a string, you can get creative:
>
> model = item_to_destroy.class.to_s.downcase
>
> self.send("#{model}_path", item_to_delete)
>

or polymorphic_path(item_to_delete) (which is what gets called if you
do button_to('delete', item_to_delete, :method => 'delete') )

Fred

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error (route not found) but only for destroy action.

2011-08-22 Thread 7stud --
Stefano wrote in post #1017840:
> Hi guys
>
> I have many different models and I want to reuse the same code for the
> delete button.
> So in my helper i have:
>
> def delete_button(item_to_delete)
> button_to t('buttons.delete'), :action => "destroy", :controller
> => item_to_delete.class.to_s.downcase.pluralize
> end
>
> Normally i work with paths a la post_path(item_to_destroy) but I cant
> find a way of making that work for different models except throwing in
> some stupid switch statement which makes the code REALLY ugly..
>

In ruby, every method has to be called by an object, and that object is 
known as the 'receiver'.  If you don't specify an object, then ruby uses 
self as the receiver.  So when you call:

post_path(item_to_delete)

that is the same as:

self.post_path(item_to_delete)

The reason the object that is calling the method is called the reciever 
is because calling a method with an object in ruby is the same as 
sending a 'message' to the object.  The message you send to the object 
is the name of the method.  In ruby, you can write that like this:

self.send(:meth_name, args)

or

self.send(:post_path, item_to_delete)

In most cases, you can use a string instead of a symbol, so that can 
also be written as:

self.send("post_path", item_to_delete)

Once you have a way to execute a method when you have the name of the 
method as a string, you can get creative:

model = item_to_destroy.class.to_s.downcase

self.send("#{model}_path", item_to_delete)


> So the code above throws a route not found error. BUT:
> def delete_button(item_to_delete)
> button_to t('buttons.delete'), :action => "new", :controller =>
> item_to_delete.class.to_s.downcase.pluralize
> end
>
> works just fine.. these are the things that really annoy me about ruby
> on rails.
>

POST v. DELETE ???


> Also.. the most ridiculous thing happens at the moment.. I use the
> asset pipeline and after rebooting all javascript code in my file
> users.js.coffee doesnt get executed in my browser anymore.. If i put
> it in example 'messages.js.coffee' it works just fine. EXACTLY the
> same syntax in both files.. I have NO idea why that happens. But
> frankly after wasting 1h on that I dont care. Just leave my code in
> the wrong file where it works..

Sorry, never used any coffescript.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error (route not found) but only for destroy action.

2011-08-22 Thread Frederick Cheung


On Aug 22, 12:48 pm, Stefano  wrote:
> Hi guys
>
> I have many different models and I want to reuse the same code for the
> delete button.
> So in my helper i have:
>
> def delete_button(item_to_delete)
>     button_to t('buttons.delete'), :action => "destroy", :controller
> => item_to_delete.class.to_s.downcase.pluralize
> end
>
> Normally i work with paths a la post_path(item_to_destroy) but I cant
> find a way of making that work for different models except throwing in
> some stupid switch statement which makes the code REALLY ugly..
>
> So the code above throws a route not found error. BUT:
> def delete_button(item_to_delete)
>     button_to t('buttons.delete'), :action => "new", :controller =>
> item_to_delete.class.to_s.downcase.pluralize
> end
>
> works just fine.. these are the things that really annoy me about ruby
> on rails.
>
You're not setting the method. REST dictates that the destroy action
can only be accessed by the DELETE method. Also, given that the path
you want to access is just the one for the post/comment/etc you don't
need the path helper at all.

button_to 'Delete', item_to_delete, :method => 'DELETE'

should do the trick

Fred
> Also.. the most ridiculous thing happens at the moment.. I use the
> asset pipeline and after rebooting all javascript code in my file
> users.js.coffee doesnt get executed in my browser anymore.. If i put
> it in example 'messages.js.coffee' it works just fine. EXACTLY the
> same syntax in both files.. I have NO idea why that happens. But
> frankly after wasting 1h on that I dont care. Just leave my code in
> the wrong file where it works..

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-28 Thread Ar Chron
amritpal p. wrote in post #995520:

> On Apr 28, 3:25am, Colin Law  wrote:
>>
>> >  root :to => "say#hello"
>>
>> So you think that the above line, which says route '/' to say#hello'
>> is going to route /say/goodbye somewhere?

>   No it will not route to /say/goodbye,but it will route to /say/
> hello which has a link to /say/goodbye method.

Umm... no it won't, as evidenced by your own statement:

> When i click on Goodbye link given in hello.html.erb file it says
> "No route matches "/say/goodbye".

Take a look at your log file and see what your Rails application is 
receiving when you click the "Goodbye" link in the browser. Review your 
routes.rb file.  If you run a

rake routes > routes.lst

then look at the routes.lst file, you'll know exactly what routes you 
have available in your application. Next, re-read the Rails guide on 
routing.

I hesitate to just say "type this code in here and it will work" because 
that doesn't lead to learning or understanding.  Directing you to look 
at your log file to see what your application is receiving, seeing what 
Rails has as routes for your application, and pointing to the correct 
reference for reading may.

It's the old "give a man a fish..." strategy.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-28 Thread amrit pal pathak


On Apr 28, 3:25 am, Colin Law  wrote:
> On 28 April 2011 02:37, amrit pal pathak  wrote:
>
>
>
>
>
>
>
>
>
>
>
> > On Apr 27, 10:52 am, Pale Horse  wrote:
> >> > amritpal p. wrote in post #995323:
>
> >> > class SayController < ApplicationController
> >> >  def hello
> >> >   @timee = Time.now
> >> >  end
> >> >  def goodbye
>
> >> >  end
> >> > end
>
> >> > /app/views/say/hello.html.erb looks like:
>
> >> > It is now <%= @timee %>
> >> > Goodbye
>
> >> Instead of Goodbye, use <%= link_to
> >> "Goodbye", :action => "goodbye" %>
> >                It didn't help,error says
> >       No route matches {:controller=>"say", :action=>"goodbye"}
>
> >> > /app/views/say/goodbye.html.erb looks like:
>
> >> > Good bye buddy!
>
> >> > When i click on Goodbye link given in hello.html.erb file it says
> >> > "No route matches "/say/goodbye". It made me desperate. I don't
> >> > know why this error persists.
>
> >> Have you set up a route for it in config/routes.rb?
> >             yes is set up as:
>
> >           root :to => "say#hello"
>
> So you think that the above line, which says route '/' to say#hello'
> is going to route /say/goodbye somewhere?  
  No it will not route to /say/goodbye,but it will route to /say/
hello which has a link to /say/goodbye method.
 Can you tell me solution?

Thanks
As I said previously you
> need to re-read the Rails Guide on routing.  Read every line and make
> sure you understand it.  If you think you already understand it then
> you are mistaken.
>
> Colin

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-28 Thread Pale Horse
> amritpal p. wrote in post #995439:
>
>> Instead of Goodbye, use <%= link_to
>> "Goodbye", :action => "goodbye" %>
>
>  It didn't help, error says:
>  No route matches {:controller=>"say", :action=>"goodbye"}

Of course it didn't, but you are working in a Rails
environment so you ought to be using Rails conventions and helpers like
'link_to'.

>>> /app/views/say/goodbye.html.erb looks like:
>>
>>> Good bye buddy!
>>
>>> When I click on Goodbye link given in hello.html.erb file it says
>>> "No route matches "/say/goodbye". It made me desperate. I don't
>>> know why this error persists.
>>
>> Have you set up a route for it in config/routes.rb?
>
> Yes is set up as:
> root :to => "say#hello"
> Thanks

I think you need to take Colin's advice - once you're *absolutely*
confident you understand the fundamentals of routing in Rails 3, you
need to check the setup of your Rails environment against a working
example, maybe by searching online or using one of your working
applications (if you have one).

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Routing Error

2011-04-28 Thread Colin Law
On 28 April 2011 02:37, amrit pal pathak  wrote:
>
>
> On Apr 27, 10:52 am, Pale Horse  wrote:
>> > amritpal p. wrote in post #995323:
>>
>> > class SayController < ApplicationController
>> >  def hello
>> >   @timee = Time.now
>> >  end
>> >  def goodbye
>>
>> >  end
>> > end
>>
>> > /app/views/say/hello.html.erb looks like:
>>
>> > It is now <%= @timee %>
>> > Goodbye
>>
>> Instead of Goodbye, use <%= link_to
>> "Goodbye", :action => "goodbye" %>
>                It didn't help,error says
>       No route matches {:controller=>"say", :action=>"goodbye"}
>>
>> > /app/views/say/goodbye.html.erb looks like:
>>
>> > Good bye buddy!
>>
>> > When i click on Goodbye link given in hello.html.erb file it says
>> > "No route matches "/say/goodbye". It made me desperate. I don't
>> > know why this error persists.
>>
>> Have you set up a route for it in config/routes.rb?
>             yes is set up as:
>
>           root :to => "say#hello"

So you think that the above line, which says route '/' to say#hello'
is going to route /say/goodbye somewhere?  As I said previously you
need to re-read the Rails Guide on routing.  Read every line and make
sure you understand it.  If you think you already understand it then
you are mistaken.

Colin

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-27 Thread amrit pal pathak


On Apr 27, 10:52 am, Pale Horse  wrote:
> > amritpal p. wrote in post #995323:
>
> > class SayController < ApplicationController
> >  def hello
> >   @timee = Time.now
> >  end
> >  def goodbye
>
> >  end
> > end
>
> > /app/views/say/hello.html.erb looks like:
>
> > It is now <%= @timee %>
> > Goodbye
>
> Instead of Goodbye, use <%= link_to
> "Goodbye", :action => "goodbye" %>
It didn't help,error says
   No route matches {:controller=>"say", :action=>"goodbye"}
>
> > /app/views/say/goodbye.html.erb looks like:
>
> > Good bye buddy!
>
> > When i click on Goodbye link given in hello.html.erb file it says
> > "No route matches "/say/goodbye". It made me desperate. I don't
> > know why this error persists.
>
> Have you set up a route for it in config/routes.rb?
 yes is set up as:

   root :to => "say#hello"

Thanks

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-27 Thread Pale Horse
> amritpal p. wrote in post #995323:
>
> class SayController < ApplicationController
>  def hello
>   @timee = Time.now
>  end
>  def goodbye
>
>  end
> end
>
> /app/views/say/hello.html.erb looks like:
>
> It is now <%= @timee %>
> Goodbye

Instead of Goodbye, use <%= link_to 
"Goodbye", :action => "goodbye" %>

> /app/views/say/goodbye.html.erb looks like:
>
> Good bye buddy!
>
> When i click on Goodbye link given in hello.html.erb file it says
> "No route matches "/say/goodbye". It made me desperate. I don't
> know why this error persists.

Have you set up a route for it in config/routes.rb?

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-27 Thread amrit pal pathak
   very strange again !!
say_controller.rb looks like:

class SayController < ApplicationController
def hello
@timee =Time.now
 end
 def goodbye
end
end

/app/view/say/hello.html.erb looks like:

It is now <%= @timee%>
Goodbye

/app/view/say/goodbye.html.erb looks like:

Good bye buddy!

 When i click on
Goodbye link given in hello.html.erb file it says
   "No route matches "/say/goodbye" .It made me desperate.i dont
know what this error persist.

Please guide.

Thanks


-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread amrit pal pathak


On Apr 26, 12:09 pm, Pale Horse  wrote:
> > amritpal p. wrote in post #995070:
> > Generated a controller "rails generate controller say" and then added
> > a method to id named hello as.
> >  def hello
> >  end
> >                             Made a file /app/view/say/hello.html.erb
> > as "sudo gedit hello.html.erb" and add follwoing to it
>
> > 
> >  
> >   Hello, Rails!
> >  
> >  
> >   Hello from Rails!
> >  
> > 
>
> > Browse to locahost:3000/say/hello gives
> > the error
> > Routing Error
> > No route matches "/say/hello.html.erb"
>
> > Amrit pal
>
> You need to add the route to config/routes.rb so that your application
> knows how to match the URL to a given controller/action pair or use a
> more vague route definition:
>
> match ':controller(/:action(/:id))'
>
> That way, any requests for /say will match this route unless any more
> specific matching routes are found earlier in the file.
>
> Also, please use a layout file for your HTML tags so that you don't have
> to use  and  tag definitions in *every* view in order to
> pass w3c validation.
ok
Thanks

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread Pale Horse
> amritpal p. wrote in post #995070:
> Generated a controller "rails generate controller say" and then added
> a method to id named hello as.
>  def hello
>  end
> Made a file /app/view/say/hello.html.erb
> as "sudo gedit hello.html.erb" and add follwoing to it
>
> 
>  
>   Hello, Rails!
>  
>  
>   Hello from Rails!
>  
> 
>
> Browse to locahost:3000/say/hello gives
> the error
> Routing Error
> No route matches "/say/hello.html.erb"
>
> Amrit pal

You need to add the route to config/routes.rb so that your application
knows how to match the URL to a given controller/action pair or use a
more vague route definition:

match ':controller(/:action(/:id))'

That way, any requests for /say will match this route unless any more
specific matching routes are found earlier in the file.

Also, please use a layout file for your HTML tags so that you don't have
to use  and  tag definitions in *every* view in order to
pass w3c validation.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread Pale Horse
> amritpal p. wrote in post #995117:
>
>> Please paste your routes.rb file here or use http://pastie.org/ if it's
>> too long.
>
> Age::Application.routes.draw do
>  root :to => "say#hello"
>  # See how all your routes lay out with "rake routes"
> end
>
> Amrit pal

What is the output of rake routes? This will show you "how all your
routes lay out".

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread amrit pal pathak


On Apr 26, 10:01 am, Pale Horse  wrote:
> > amritpal p. wrote in post #995108:
>
> >> On Apr 26, 9:26am, Pale Horse  wrote:
> >> the root route to take effect."
> > it helped but without deleting that file and setting routing
> > path to say controller "localhost:3000/say/hello" wasn't work? i think
> > it should work
>
> >> What happens if you match 'say', :to => 'say#hello' and navigate your
> >> browser to /say?
>
> > it said " No route matches "/say/hello"".
> > Thanks
>
> Please paste your routes.rb file here or usehttp://pastie.org/if it's
> too long.

Age::Application.routes.draw do
  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller
and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as
=> :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions
automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  # member do
  #   get 'short'
  #   post 'toggle'
  # end
  #
  # collection do
  #   get 'sold'
  # end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  # resources :comments, :sales
  # resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  # resources :comments
  # resources :sales do
  #   get 'recent', :on => :collection
  # end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  # # Directs /admin/products/* to Admin::ProductsController
  # # (app/controllers/admin/products_controller.rb)
  # resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  root :to => "say#hello"

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for
RESTful applications.
  # Note: This route will make all actions in every controller
accessible via GET requests.
  # match ':controller(/:action(/:id(.:format)))'
end

Amrit pal

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread Pale Horse
> amritpal p. wrote in post #995108:
>
>> On Apr 26, 9:26am, Pale Horse  wrote:
>> the root route to take effect."
> it helped but without deleting that file and setting routing
> path to say controller "localhost:3000/say/hello" wasn't work? i think
> it should work
>
>> What happens if you match 'say', :to => 'say#hello' and navigate your
>> browser to /say?
>
> it said " No route matches "/say/hello"".
> Thanks

Please paste your routes.rb file here or use http://pastie.org/ if it's
too long.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread amrit pal pathak


On Apr 26, 9:26 am, Pale Horse  wrote:
> > amritpal p. wrote in post #995099:
>
> > ok .Done
> > "root :to => "say#hello"". Still unsussess.
> > No route matches "/say/hello"
>
> > Thank you.
>
> Quoted from the Rails guide: "You should put the root route at the end
> of the file. You also need to delete the public/index.html.erb file for
> the root route to take effect."
 it helped.but without deleting that file and setting routing
path to say controller "localhost:3000/say/hello" wasn't work?i think
it should work

> Rails will look in app/controllers for a controller named
> 'say_controller'. Inside that, it will search for an action with the
> name 'hello' and then will render that action using hello.html.erb in
> app/views/say
>
> If it is not doing this, then there is something you've omitted when
> trying to explain the issue.
>
> What is the output of rake routes?
>
> What happens if you match 'say', :to => 'say#hello' and navigate your
> browser to /say?
   it said " No route matches "/say/hello"".
Thanks

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread Pale Horse
> amritpal p. wrote in post #995099:
>
> ok .Done
> "root :to => "say#hello"". Still unsussess.
> No route matches "/say/hello"
>
> Thank you.

Quoted from the Rails guide: "You should put the root route at the end
of the file. You also need to delete the public/index.html.erb file for
the root route to take effect."

Rails will look in app/controllers for a controller named
'say_controller'. Inside that, it will search for an action with the
name 'hello' and then will render that action using hello.html.erb in
app/views/say

If it is not doing this, then there is something you've omitted when
trying to explain the issue.

What is the output of rake routes?

What happens if you match 'say', :to => 'say#hello' and navigate your
browser to /say?

Please see the following screencasts for routing in Rails 3.x:

http://railscasts.com/episodes/231-routing-walkthrough
http://railscasts.com/episodes/232-routing-walkthrough-part-2

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread amrit pal pathak


On Apr 26, 8:31 am, Colin Law  wrote:
> On 26 April 2011 13:22, amrit pal pathak  wrote:
>
>
>
> > On Apr 26, 7:54 am, Frederick Cheung 
> > wrote:
> >> On 26 Apr 2011, at 10:51, amrit pal pathak  
> >> wrote:
>
> >> > Generated a controller "rails generate controller say" and then added
> >> > a method to id named hello as.
>
> >> You need to add a route to the action. Colin discussed this with you at 
> >> some length last week.
> >        Yes he discussed ,but thats was only if i want to see hello
> > action at "localhost:3000".   But to see hello method at "localhost:
> > 3000/say/hello" doesn't need any routing settings.
>
> Yes it does.  Go and read the Rails Guide on routing again.
ok .Done
   " root :to => "say#hello"".Still unsussess.
 No route matches "/say/hello"

Thank you.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Routing Error

2011-04-26 Thread Colin Law
On 26 April 2011 13:22, amrit pal pathak  wrote:
>
>
> On Apr 26, 7:54 am, Frederick Cheung 
> wrote:
>> On 26 Apr 2011, at 10:51, amrit pal pathak  wrote:
>>
>> > Generated a controller "rails generate controller say" and then added
>> > a method to id named hello as.
>>
>> You need to add a route to the action. Colin discussed this with you at some 
>> length last week.
>        Yes he discussed ,but thats was only if i want to see hello
> action at "localhost:3000".   But to see hello method at "localhost:
> 3000/say/hello" doesn't need any routing settings.

Yes it does.  Go and read the Rails Guide on routing again.

Colin

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread amrit pal pathak


On Apr 26, 7:54 am, Frederick Cheung 
wrote:
> On 26 Apr 2011, at 10:51, amrit pal pathak  wrote:
>
> > Generated a controller "rails generate controller say" and then added
> > a method to id named hello as.
>
> You need to add a route to the action. Colin discussed this with you at some 
> length last week.
Yes he discussed ,but thats was only if i want to see hello
action at "localhost:3000".   But to see hello method at "localhost:
3000/say/hello" doesn't need any routing settings.Still it is not
showing it
Why?

Thanks

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread Tim Shaffer
It looks like you were trying to access "/say/hello.html.erb" as the URL 
rather than "say/hello"

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2011-04-26 Thread amrit pal pathak
Please somebody help me.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error with OmniAuth

2011-04-14 Thread skt


On Apr 14, 7:28 pm, Phil Crissman  wrote:
> Phil
>
>
>
>
>
>
>
>
>
> On Thu, Apr 14, 2011 at 6:29 PM, skt  wrote:
> > Hello,
>
> > I am trying to use OmniAuth with Devise and I am stumbling on some
> > initial step. When I go to localhost:3000/auth/twitter I get a routing
> > error
>
> > No route matches "/auth/twitter"
>
> > I have the "gem omniauth" in my gemfile and I have omniauth.rb where I
> > have setup twitter connection as below
>
> > Rails.application.config.middleware.use OmniAuth::Builder do
> >  provider :twitter, 'MY KEY', 'MY SECRET'
> > end
>
> > The server starts up fine - the home page loads. I am on Ruby
> > 1.9.2p180 and Rails 3.0.5 on a Win box.
>
> > Thanks for any pointers on what I may be missing here.
>
> Given the error, you're probably missing a route. The gem does not provide
> automatically provide one (at least, it didn't when I used it), you'll need
> to add it to the routes file.
>

That would be the natural conclusion - missing something in routes.rb
- but I checked Ryan Bates' screencast (downloaded his screencast code
and looked in the routes.rb file there) and other Omniauth
documentation and unless I am missing something staring in my face, I
don't see anything added to routes.rb for this. Per the documentation
you do need to add to routes.rb to handle the callback (/auth/twitter/
callback) but nothing for the initial call to /auth/twitter.

Thanks for thoughts or pointers you can help provide.

>
> > -S
>
> > --
> > 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 rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error : No route matches "/" (for "Hello World!" action)

2011-04-07 Thread Bruce Wilson
On Apr 7, 2:16 pm, Frederick Cheung 
wrote:
> On Apr 7, 10:02 pm, Bruce Wilson  wrote:
>
>
>
>
>
>
>
> > On Apr 7, 11:17 am, mainguy  wrote:
>
> > > I don't see that you've routed anything to the '/' path.
>
> > > Your route requires the controller to be in the path.
>
> > > First step would be to uncomment this
> > >  # You can have the root of your site routed with "root"
> > >   # just remember to delete public/index.html.
> > >   # root :to => "welcome#index"
>
> > > replacing 'welcome' with the controller you want / to route to and
> > > index.html with the action.
>
> > > Along those lines, usually there  is a public/index.html that should
> > > be displayed.
>
> > > Do you have a file in public/html?
>
> > I'm following the instructions in Beginning Rails 3:
>
> > $ rails generate controller salutation
> > Then I added a Hello method to the controller.
> > Then I created a hello.html.erb template in app/views/salutation.
>
> > So the routes.rb file with this code:
>
> > Hello::Application.routes.draw do
> >      match ':controller(/:action(/:id(.:format)))'
> > end
>
> > is supposed to deliver the desired result of "Hello World!".
>
> > But I went ahead and changed the routes.rb file to read:
>
> > Hello::Application.routes.draw do
> > root :to => "salutation#hello"
>
> > That delivers the Hello World! in the browser, but along with the .erb
> > code:
>
> > {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss
> > \fcharset0 Arial;}} {\*\generator Msftedit
> > 5.41.21.2509;}\viewkind4\uc1\pard\f0\fs20 \par \tab \par \tab\tab
> > Hello World!
> > \par \tab \par \par }
> > What to do?
>
> That looks like you edited your template with an editor that saved it
> as an rtf file rather than plain text.
>
> Fred

You're right!  Much thanks to all of the above responders.

But for the sake of learning, can anyone tell me why the Beginning
Rails 3 code doesn't work, and what exactly is it supposed to do?

> > Hello::Application.routes.draw do
> >  match ':controller(/:action(/:id(.:format)))'
> > end

Bruce

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error : No route matches "/" (for "Hello World!" action)

2011-04-07 Thread Frederick Cheung


On Apr 7, 10:02 pm, Bruce Wilson  wrote:
> On Apr 7, 11:17 am, mainguy  wrote:
>
>
>
>
>
> > I don't see that you've routed anything to the '/' path.
>
> > Your route requires the controller to be in the path.
>
> > First step would be to uncomment this
> >  # You can have the root of your site routed with "root"
> >   # just remember to delete public/index.html.
> >   # root :to => "welcome#index"
>
> > replacing 'welcome' with the controller you want / to route to and
> > index.html with the action.
>
> > Along those lines, usually there  is a public/index.html that should
> > be displayed.
>
> > Do you have a file in public/html?
>
> I'm following the instructions in Beginning Rails 3:
>
> $ rails generate controller salutation
> Then I added a Hello method to the controller.
> Then I created a hello.html.erb template in app/views/salutation.
>
> So the routes.rb file with this code:
>
> Hello::Application.routes.draw do
>      match ':controller(/:action(/:id(.:format)))'
> end
>
> is supposed to deliver the desired result of "Hello World!".
>
> But I went ahead and changed the routes.rb file to read:
>
> Hello::Application.routes.draw do
> root :to => "salutation#hello"
>
> That delivers the Hello World! in the browser, but along with the .erb
> code:
>
> {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss
> \fcharset0 Arial;}} {\*\generator Msftedit
> 5.41.21.2509;}\viewkind4\uc1\pard\f0\fs20 \par \tab \par \tab\tab
> Hello World!
> \par \tab \par \par }
>
That looks like you edited your template with an editor that saved it
as an rtf file rather than plain text.

Fred
> What to do?

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error : No route matches "/" (for "Hello World!" action)

2011-04-07 Thread Bruce Wilson
On Apr 7, 11:17 am, mainguy  wrote:
> I don't see that you've routed anything to the '/' path.
>
> Your route requires the controller to be in the path.
>
> First step would be to uncomment this
>  # You can have the root of your site routed with "root"
>   # just remember to delete public/index.html.
>   # root :to => "welcome#index"
>
> replacing 'welcome' with the controller you want / to route to and
> index.html with the action.
>
> Along those lines, usually there  is a public/index.html that should
> be displayed.
>
> Do you have a file in public/html?


I'm following the instructions in Beginning Rails 3:

$ rails generate controller salutation
Then I added a Hello method to the controller.
Then I created a hello.html.erb template in app/views/salutation.

So the routes.rb file with this code:

Hello::Application.routes.draw do
 match ':controller(/:action(/:id(.:format)))'
end

is supposed to deliver the desired result of "Hello World!".

But I went ahead and changed the routes.rb file to read:

Hello::Application.routes.draw do
root :to => "salutation#hello"

That delivers the Hello World! in the browser, but along with the .erb
code:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss
\fcharset0 Arial;}} {\*\generator Msftedit
5.41.21.2509;}\viewkind4\uc1\pard\f0\fs20 \par \tab \par \tab\tab
Hello World!
\par \tab \par \par }

What to do?

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error : No route matches "/" (for "Hello World!" action)

2011-04-07 Thread mainguy
I don't see that you've routed anything to the '/' path.

Your route requires the controller to be in the path.

First step would be to uncomment this
 # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => "welcome#index"

replacing 'welcome' with the controller you want / to route to and
index.html with the action.

Along those lines, usually there  is a public/index.html that should
be displayed.

Do you have a file in public/html?

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error : No route matches "/" (for "Hello World!" action)

2011-04-07 Thread Frederick Cheung


On Apr 7, 6:51 pm, Bruce Wilson  wrote:
> My routes.rb reads at the top:
>
> Hello::Application.routes.draw do
>   match ':controller(/:action(/:id(.:format)))'
>
> and then all the commented material it comes with and an "end" at the
> end of the file.
>
> But when I typehttp://localhost:3000into my browser I get the
> following error message:
>
> Routing Error
> No route matches "/"
>
> I'm stumped.
>
The above means that rails can only recognized paths that start with
the name of a controller, optionally followed by an action and id. '/'
clearly doesn't fall into that pattern so you get a routing error. One
way of specifying a default root is by saying

root :to => 'pages#main'

which says that / should be routed to the main action in
PagesController

Fred

> Bruce

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error

2011-01-26 Thread Kostas L.
Hi Marnen,
i have created a projects controller with a field called status. The
"status" have the following values: "suggested", "inprogress" and
"finished". I want to be able to use these actions:
project/suggested/new
project/suggested/1/edit
project/suggested/assign_to_student
...
...
project/finished/new
project/finished/1/edit
etc

The goal is to be able to edit,update,create, delete (and some other
actions) a project while having a specific status. The forms in each
value should be different.



On Jan 26, 5:07 pm, Marnen Laibow-Koser  wrote:
> Kostas Lps wrote in post #976978:
>
> > Hi guys,
> > i have a model named "project" and i have created routes namespace:
> >   namespace :project do
> >     resources :inprocess do
> >       get 'assign', :on => :collection
> >     end
> >     resources :suggested do
> >       get 'select_list', :on => :collection
> >       post 'select_list', :on => :collection
> >     end
> >    resources :finished
> >   end
>
> I think you're abusing nested resources.  inprocess, suggested, and
> finished probably shouldn't be resources of their own.  What are you
> trying to achieve here?
>
> Best,
> -- 
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
>
> Sent from my iPhone
>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error

2011-01-26 Thread Marnen Laibow-Koser
Kostas Lps wrote in post #976978:
> Hi guys,
> i have a model named "project" and i have created routes namespace:
>   namespace :project do
> resources :inprocess do
>   get 'assign', :on => :collection
> end
> resources :suggested do
>   get 'select_list', :on => :collection
>   post 'select_list', :on => :collection
> end
>resources :finished
>   end

I think you're abusing nested resources.  inprocess, suggested, and 
finished probably shouldn't be resources of their own.  What are you 
trying to achieve here?

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Routing error

2011-01-25 Thread loganathan sellappa
Try this route format:

>  namespace :project do
>resources :inprocess do
>   collection do
> :get => 'assign'
>end
>end
>resources :suggested do
>collection do
>
  :get => 'select_list'
>
  :post =>  'select_list'
  end
  end

>   resources :finished
>  end
>

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Routing error

2011-01-25 Thread loganathan sellappa
 namespace :project do
   resources :inprocess do
  collection do
 get => 'assign'

   end
   resources :suggested do
 get 'select_list', :on => :collection
 post 'select_list', :on => :collection
   end
  resources :finished
 end

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error

2011-01-25 Thread Kostas L.
Any ideas guys??? I would appreciate any suggestion!

Regards
Kostas

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2010-12-06 Thread Priya Buvan
Hi Kannav,

Thank you for your support. I have mistyped url in routes, so the issue 
arose. Now it is solved.

Thanks,
Buvana

Kannav R. wrote in post #966458:
> please post  some code here yours controllers index method and routs.rb
> line which contains this URL
>
> On Mon, Dec 6, 2010 at 3:35 PM, Priya Buvan 
> wrote:
>
>>  
>> /usr/lib/ruby/1.8/action_controller/routing/recognition_optimisation.rb:66:in
>>  /usr/lib/ruby/1.8/rack/head.rb:9:in `call'
>>  /usr/lib/ruby/1.8/action_controller/dispatcher.rb:108:in `call'
>>  /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
>>
>> To unsubscribe from this group, send email to
>>
> 
rubyonrails-talk+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>
>
> --
> Thanks:
> Rajeev sharma
> +919013155133

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2010-08-20 Thread Adam
I can generate dispatch with rake rails:update:generate_dispatchers
command

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2010-08-20 Thread Adam
Bluehost

On aug. 20, 16:58, Frederick Cheung 
wrote:
> On Aug 20, 2:23 pm, Adam  wrote:
>
> > Hi!
> > I deployed my app in my shared hosting. If I open dispatch.fcgi, i get
> > this error:
>
> >     Routing Error
>
> > No route matches "/public/dispatch.fcgi" with {:method=>:get}
> > Before this app works fine in localhost. Whats wrong?
>
> How is the app hosted? If my memory is correct the fcgi dispatch stuff
> was removed from recent versions of rails
>
> Fred

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error

2010-08-20 Thread Frederick Cheung


On Aug 20, 2:23 pm, Adam  wrote:
> Hi!
> I deployed my app in my shared hosting. If I open dispatch.fcgi, i get
> this error:
>
>     Routing Error
>
> No route matches "/public/dispatch.fcgi" with {:method=>:get}
> Before this app works fine in localhost. Whats wrong?

How is the app hosted? If my memory is correct the fcgi dispatch stuff
was removed from recent versions of rails

Fred

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error in Rails 3

2010-03-21 Thread rjunee
Turns out this was caused because my controller was singular
(ProspectController) instead of plural (ProspectsController).

On Mar 20, 12:42 pm, rjunee  wrote:
> I use:
>
> <% form_for @prospect do |f| %>
>
> which generates:
>
>  method="post">
>
> Cheers,
> Ryan
>
> On Mar 20, 5:31 am, Conrad Taylor  wrote:
>
>
>
> > On Sat, Mar 20, 2010 at 1:52 AM, rjunee  wrote:
> > > I'm hoping someone can advise me on how to debug this routing error.
>
> > > My routes.rb includes:
> > >  resources :prospects, :only => ["create"]
>
> > > rake routes shows:
> > >  prospects POST /prospects(.:format)
> > > {:controller=>"prospects", :action=>"create"}
>
> > > However when I try to post a form I get:
>
> > > Started POST "/prospects" for 127.0.0.1 at 2010-03-20 01:44:29
>
> > > ActionController::RoutingError (No route matches "/prospects"):
>
> > > Rendered /Users/ryan/.rvm/gems/ruby-1.9.1-p378/gems/
> > > actionpack-3.0.0.beta/lib/action_dispatch/middleware/templates/rescues/
> > > routing_error.erb within /Users/ryan/.rvm/gems/ruby-1.9.1-p378/gems/
> > > actionpack-3.0.0.beta/lib/action_dispatch/middleware/templates/rescues/
> > > layout.erb (0.9ms)
>
> > > Any ideas?
>
> > Hi, how are you trying to post the form?
>
> > -Conrad
>
> > > --
> > > 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 rubyonrails-t...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > rubyonrails-talk+unsubscr...@googlegroups.com > >  e...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error in Rails 3

2010-03-20 Thread rjunee
I use:

<% form_for @prospect do |f| %>

which generates:




Cheers,
Ryan


On Mar 20, 5:31 am, Conrad Taylor  wrote:
> On Sat, Mar 20, 2010 at 1:52 AM, rjunee  wrote:
> > I'm hoping someone can advise me on how to debug this routing error.
>
> > My routes.rb includes:
> >  resources :prospects, :only => ["create"]
>
> > rake routes shows:
> >  prospects POST /prospects(.:format)
> > {:controller=>"prospects", :action=>"create"}
>
> > However when I try to post a form I get:
>
> > Started POST "/prospects" for 127.0.0.1 at 2010-03-20 01:44:29
>
> > ActionController::RoutingError (No route matches "/prospects"):
>
> > Rendered /Users/ryan/.rvm/gems/ruby-1.9.1-p378/gems/
> > actionpack-3.0.0.beta/lib/action_dispatch/middleware/templates/rescues/
> > routing_error.erb within /Users/ryan/.rvm/gems/ruby-1.9.1-p378/gems/
> > actionpack-3.0.0.beta/lib/action_dispatch/middleware/templates/rescues/
> > layout.erb (0.9ms)
>
> > Any ideas?
>
> Hi, how are you trying to post the form?
>
> -Conrad
>
>
>
> > --
> > 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 rubyonrails-t...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com > e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: Routing Error on rails3

2010-03-18 Thread Felipe Rodrigues




Rails 3 doesn't come with a generic rout mapping for controllers.
The generator for models or scaffold will add the models as resources
routes, so it will be RESTfull by default.

It means that in any new rails 3 app, you will have to explicitly
change the routes.rb to add the routes that are not related to a REST
resource.
Isn't it great? I love rails 3.

[]'s

Felipe

Ugis Ozols wrote:

  Hello,

Here's how your routes.rb file should like for that /pages/home route
to work: http://gist.github.com/316367

In rails 3 rule for catching non-rest routes is deprecated so it's
commented out in routes.rb. You can read about it in Rails 3.0 Release
Notes - http://guides.rails.info/3_0_release_notes.html#action-dispatch

On Feb 26, 10:47 pm, John Wu  wrote:
  
  
Hi All,

I am new to Ruby on Rails and have rails3 installed.

After I type this on the command line

$rails g controller Pages home contact

then, I go tohttp://localhost:3000/pages/home

I got

Routing Error

No route matches "/pages/contact"

How can I fix this problem?

Thanks!
--
Posted viahttp://www.ruby-forum.com/.

  
  
  






-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




[Rails] Re: Routing Error on rails3

2010-02-26 Thread Ugis Ozols
Hello,

Here's how your routes.rb file should like for that /pages/home route
to work: http://gist.github.com/316367

In rails 3 rule for catching non-rest routes is deprecated so it's
commented out in routes.rb. You can read about it in Rails 3.0 Release
Notes - http://guides.rails.info/3_0_release_notes.html#action-dispatch

On Feb 26, 10:47 pm, John Wu  wrote:
> Hi All,
>
> I am new to Ruby on Rails and have rails3 installed.
>
> After I type this on the command line
>
> $rails g controller Pages home contact
>
> then, I go tohttp://localhost:3000/pages/home
>
> I got
>
> Routing Error
>
> No route matches "/pages/contact"
>
> How can I fix this problem?
>
> Thanks!
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error on rails3

2010-02-26 Thread John Wu
Thanks,

How to uninstall it on mac? Can I have two version of Rails on same 
machine that I can choose one to run?

Colin Law wrote:
> On 26 February 2010 20:47, John Wu  wrote:
>> Hi All,
>>
>> I am new to Ruby on Rails and have rails3 installed.
> 
> Did you really mean to start with rails 3?  It is still under
> development and you may well run into problems that are not of your
> own making.  If you are learning rails I would suggest installing the
> latest 2.3.x and you will find getting started guides to help you get
> going at http://guides.rubyonrails.org.  I believe that it is
> necessary to uninstall rails 3 before installing 2.3.x though I may be
> mistaken.
> 
> Colin

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error on rails3

2010-02-26 Thread John Wu
Thanks for the reply.

I didn't change rout file.

SampleApp::Application.routes.draw do |map|
end

What do I need to add?

Conrad Taylor wrote:
> On Fri, Feb 26, 2010 at 12:47 PM, John Wu  wrote:
> 
>> I got
>>
>> Routing Error
>>
>> No route matches "/pages/contact"
>>
>> How can I fix this problem?
>>
>> Thanks!
>>
> 
> Please post your routes file.
> 
> -Conrad

-- 
Posted via http://www.ruby-forum.com/.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error using Paperclip

2010-02-26 Thread Rajinder Yadav

Rajinder Yadav wrote:

Rajinder Yadav wrote:
For some reason I can't figure out why I am getting a routing error 
when I add Paperclip support. I have another test app when similar 
code is working.


I created a new test app first without Paperclip support and it was 
doing the CRUD operation fine. However when I added Paperclip support 
I get the following error?


Routing Error
user_url failed to generate from {:action=>"show", 
:controller=>"users", :id=>#"Yadav", email: "t...@email.com", password: "hello", membership_level: 
0, location: nil, timezone: nil, bday: nil, last_visit: nil, visits: 
nil, created_at: nil, updated_at: nil, photo_file_name: 
"devmentor.jpg", photo_content_type: "image/jpeg", photo_file_size: 
34846>}, expected: {:action=>"show", :controller=>"users"}, diff: 
{:id=>#"t...@email.com", password: "password", membership_level: 0, location: 
nil, timezone: nil, bday: nil, last_visit: nil, visits: nil, 
created_at: nil, updated_at: nil, photo_file_name: "devmentor.jpg", 
photo_content_type: "image/jpeg", photo_file_size: 34846>}



The form I am using to submit looks like this

<% form_for @user, :html => { :multipart => true } do |f| %>
  <%= f.label :name %>
  <%= f.text_field :name %>
  <%= f.label :surname %>
  <%= f.text_field :surname %>
  <%= f.label :email %>
  <%= f.text_field :email %>
  <%= f.label :password %>
  <%= f.password_field :password  %>
  
<%= f.label 'Picture' %>
<%= f.file_field :photo%>
  
  <%= submit_tag 'Create Account' %>
<% end %>


and the entries in routes.rb are

  map.resources :users
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'



I narrowed the error down, it seems that the call to create is failing?

@user = User.create params[:user]
redirect_to user_path @user

so the redirect is producing the error. I have no idea why create is 
failing, it was working before I added the Paperclip support.


I found the reason why I was getting an error, it was a thumbnail 
processing error. I recall installing RMagick lastnight and I think I 
read somewhere it download installs its own version of ImageMagick? The 
Fix was for me to reinstall ImageMagick and now the code is working.


Does RMagick really break functionality fir Paperclip if it's installed 
after? If this is the case I think this should be fixed. I spent a few 
hours last night trying to figure out the error. All was not, being new 
to Rails I learned how to track down the error, but still burning hours 
on something like this is not the best use of anyone's time!!!


Kind Regards,
Rajinder Yadav

--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing Error using Paperclip

2010-02-26 Thread Rajinder Yadav

Rajinder Yadav wrote:
For some reason I can't figure out why I am getting a routing error when 
I add Paperclip support. I have another test app when similar code is 
working.


I created a new test app first without Paperclip support and it was 
doing the CRUD operation fine. However when I added Paperclip support I 
get the following error?


Routing Error
user_url failed to generate from {:action=>"show", :controller=>"users", 
:id=>#"t...@email.com", password: "hello", membership_level: 0, location: nil, 
timezone: nil, bday: nil, last_visit: nil, visits: nil, created_at: nil, 
updated_at: nil, photo_file_name: "devmentor.jpg", photo_content_type: 
"image/jpeg", photo_file_size: 34846>}, expected: {:action=>"show", 
:controller=>"users"}, diff: {:id=>#surname: "Yadav", email: "t...@email.com", password: "password", 
membership_level: 0, location: nil, timezone: nil, bday: nil, 
last_visit: nil, visits: nil, created_at: nil, updated_at: nil, 
photo_file_name: "devmentor.jpg", photo_content_type: "image/jpeg", 
photo_file_size: 34846>}



The form I am using to submit looks like this

<% form_for @user, :html => { :multipart => true } do |f| %>
  <%= f.label :name %>
  <%= f.text_field :name %>
  <%= f.label :surname %>
  <%= f.text_field :surname %>
  <%= f.label :email %>
  <%= f.text_field :email %>
  <%= f.label :password %>
  <%= f.password_field :password  %>
  
<%= f.label 'Picture' %>
<%= f.file_field :photo%>
  
  <%= submit_tag 'Create Account' %>
<% end %>


and the entries in routes.rb are

  map.resources :users
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'



I narrowed the error down, it seems that the call to create is failing?

@user = User.create params[:user]
redirect_to user_path @user

so the redirect is producing the error. I have no idea why create is 
failing, it was working before I added the Paperclip support.


--
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Routing error

2009-11-16 Thread Todd A. Jacobs

On Mon, Nov 16, 2009 at 05:46:57AM -0800, Frederick Cheung wrote:

> You're not really - you're setting it in the new method, but not in
> the create one (or are you using the nested attributes stuff) ?

If I call 

@note = @property.notes.new

from the console, it properly populates the property_id and passes it
onto the note object. I've been trying this different ways, and maybe I
don't really understand what's being called when I do it via the web.

At present, I'm calling this from the properties controller, rather than
the notes controller, in the show action (which is where I have embedded
the New Note form). I'm not sure how to do it in notes.new or
notes.create, since I don't understand how to propogate the parent ID to
the notes controller from the property controller that way.

Can you offer a practical snippet for me to try?

-- 
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"


--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-11-16 Thread Frederick Cheung



On Nov 16, 12:45 pm, "Todd A. Jacobs"  wrote:
> On Mon, Nov 16, 2009 at 04:30:23AM -0800, Frederick Cheung wrote:
> > The error is telling you that you called property_path(nil) - for
> > whatever reason @note.property_id isn't set.
>
> Thanks. I had suspected as much, but still found the error rather
> opaque. Still, I don't understand *why* it's being unset, since I'm
> setting it explicitly in the property controller.
>
You're not really - you're setting it in the new method, but not in
the create one (or are you using the nested attributes stuff) ?

Fred
> Rather than guessing at why, though, what I'd really like is a reliable
> mechanism to populate @note.property_id from the properties
> controller--or perhaps from the notes controller if I can somehow get at
> the referrer.
>
> Is there a way to call Note.new with arbitrary values?
>
> --
> "Oh, look: rocks!"
>         -- Doctor Who, "Destiny of the Daleks"
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-11-16 Thread Todd A. Jacobs

On Mon, Nov 16, 2009 at 04:30:23AM -0800, Frederick Cheung wrote:

> The error is telling you that you called property_path(nil) - for
> whatever reason @note.property_id isn't set.

Thanks. I had suspected as much, but still found the error rather
opaque. Still, I don't understand *why* it's being unset, since I'm
setting it explicitly in the property controller.

Rather than guessing at why, though, what I'd really like is a reliable
mechanism to populate @note.property_id from the properties
controller--or perhaps from the notes controller if I can somehow get at
the referrer.

Is there a way to call Note.new with arbitrary values?

-- 
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"


--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-11-16 Thread Frederick Cheung

On Nov 16, 9:46 am, "Todd A. Jacobs"  wrote:
> The form displays correctly, but gives a routing error when saving. I'm
> not sure what the error is trying to tell me.

The error is telling you that you called property_path(nil) - for
whatever reason @note.property_id isn't set.

Fred
>
> This works fine from the console, insofar as I can call
> "@no...@property.note.new; @note.save" and have it save successfully.
> How can I do it from a view?
>
> Ultimately, the goal is to populate notes linked to the property_id
> without resorting to either hidden fields (insecure) or session
> variables. I thought a form was the way to go, but I'm really stuck.
>
> --
> "Oh, look: rocks!"
>         -- Doctor Who, "Destiny of the Daleks"
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error if using ssl_required

2009-10-18 Thread Adam Meyer

Adam Meyer wrote:
> Hi everyone,
> 
> I am running into a routing error when activating ssl.
> Everything works fine, when I put
> 
> ssl_required :index
> 
> into the controller I get a routing error
> 
> Routing Error
> 
> No route matches "/meinkwikit" with {:method=>:get}
> 
> I installed the ssl plugin and putinclude SslRequirement into my
> application_controller.
> 
> Does anybody know what I am doing wrong?
> 
> Thanks in advance
> 
> Adam

Solution: Server routed all *:443 requests to another rails app.

Sorry.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error with Rails 2.3.3

2009-08-22 Thread CCH

Hi

The routing error was caused by Linux case-sensitivity of file names.
As such, this issue is closed.


CCH
http://cch4rails.blogspot.com



On Aug 21, 10:33 am, CCH  wrote:
> Hi All
>
> This piece of code works in Rails 1.2
> 
>
> But crashes in Rails 2.2.3
>
> Processing ApplicationController#index (for 127.0.0.1 at 2009-08-21
> 10:22:23) [GET]
>
> ActionController::RoutingError (No route matches "/images/crm.jpg"
> with {:method=>:get}):
>   -e:2:in `load'
>   -e:2
>
> Rendering rescues/layout (not_found)
>
> How can I configure the correct route in routes.rb ?
>
> TIA
>
> CCHhttp://cch4rails.blogspot.com
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread Dwight Shackelford

James Byrne wrote:

> Start here: 
> http://www.tutorialspoint.com/ruby-on-rails/rails-introduction.htm
> 
> READ it all.  It is old and out of date, but is so generic that this 
> barely matters. Then, either set up a Rails project from scratch 
> following the tutorial or connect with somebody that has at least a 
> passing familiarity with the framework and have them do it with you.
> 
> If mongrel will not start for any project other than cookbook then your 
> problem is that each of the other projects has a fatal error that 
> prevents the server from starting.  When this happens the cause is sent 
> to stderr which, if you are starting it from a virtual terminal session, 
> will be your display.  Follow the stack trace to locate the problem.
> 
> But, do the tutorial first.

Thanks James.  Appreciate it.

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread Dwight Shackelford

Marnen Laibow-Koser wrote:
> Dwight Shackelford wrote:
> [...]
>> I started two weeks late into a 5 week class.
> 
> A class in Rails development, I take it?
> 
>>  What you're witnessing is 
>> thrashing.
> 
> Then please...talk to your instructor.  Spend your time on that, not 
> just posting on the list.

It's an online class.  Instructor access is limited.

Regarding posting on this list, it's another avenue for me to get some 
info.  Like the tutorial above.  Things like InstantRails don't really 
have a manual that I can look a bunch of stuff up in.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread James Byrne

Dwight Shackelford wrote:

> 
> Well, cookbook is not one I wrote, but sometimes it is the only one 
> Mongrel will start for.  I just thought that it started Mongrel.  Didn't 
> know it was starting it specifically for a certain subdirectory.
> 
> What is the mechanism behind that?  What do I check to see where Mongrel 
> is listening?
> 
> I started two weeks late into a 5 week class.  What you're witnessing is 
> thrashing.

Start here: 
http://www.tutorialspoint.com/ruby-on-rails/rails-introduction.htm

READ it all.  It is old and out of date, but is so generic that this 
barely matters. Then, either set up a Rails project from scratch 
following the tutorial or connect with somebody that has at least a 
passing familiarity with the framework and have them do it with you.

If mongrel will not start for any project other than cookbook then your 
problem is that each of the other projects has a fatal error that 
prevents the server from starting.  When this happens the cause is sent 
to stderr which, if you are starting it from a virtual terminal session, 
will be your display.  Follow the stack trace to locate the problem.

But, do the tutorial first.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread Marnen Laibow-Koser

Dwight Shackelford wrote:
[...]
> I started two weeks late into a 5 week class.

A class in Rails development, I take it?

>  What you're witnessing is 
> thrashing.

Then please...talk to your instructor.  Spend your time on that, not 
just posting on the list.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread Dwight Shackelford

James Byrne wrote:
> Dwight Shackelford wrote:
>> 
>> InstantRails has a button that says "Start project with Mongrel".  I'll 
>> sometimes hit that, just to get Mongrel listening, then from the web 
>> page pull up different projects.  Not sure if that's the issue or not.
> 
> Just to double check the obvious, when you start the mongrel cluster are 
> you sure that you are starting it in the correct (cookbook) project root 
> directory every time?

Well, cookbook is not one I wrote, but sometimes it is the only one 
Mongrel will start for.  I just thought that it started Mongrel.  Didn't 
know it was starting it specifically for a certain subdirectory.

What is the mechanism behind that?  What do I check to see where Mongrel 
is listening?

I started two weeks late into a 5 week class.  What you're witnessing is 
thrashing.

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread James Byrne

Dwight Shackelford wrote:
> 
> InstantRails has a button that says "Start project with Mongrel".  I'll 
> sometimes hit that, just to get Mongrel listening, then from the web 
> page pull up different projects.  Not sure if that's the issue or not.

Just to double check the obvious, when you start the mongrel cluster are 
you sure that you are starting it in the correct (cookbook) project root 
directory every time?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread Dwight Shackelford

James Byrne wrote:
> Dwight Shackelford wrote:
>> I wiped the logs, because data from differing projects were getting 
>> written to multiple logs, meaning a specific log under a specific 
>> subdirectory included data from other projects too.  To get a clean run, 
>> I truncated them.  Cookbook runs now.  Phonebook did not, and no log was 
>> written for the attempt to run it.  Not that I can find.
> 
> I am curious about this statement.  How did you arrange to have 
> different projects write to the same log/development log?  You do not 
> have multiple Rails projects in the same root directory perchance?

Don't know how it happened.  There's duplicate log files under the 
separate projects.

InstantRails sort of enforces the following directory structure:

C:\InstantRails\Rails_Apps\[Project1]\
C:\InstantRails\Rails_Apps\[Project2]\
C:\InstantRails\Rails_Apps\[Project3]\
etc.

Except the log files under the different projects seem to contain the 
same info.

InstantRails has a button that says "Start project with Mongrel".  I'll 
sometimes hit that, just to get Mongrel listening, then from the web 
page pull up different projects.  Not sure if that's the issue or not.

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread James Byrne

Dwight Shackelford wrote:
> I wiped the logs, because data from differing projects were getting 
> written to multiple logs, meaning a specific log under a specific 
> subdirectory included data from other projects too.  To get a clean run, 
> I truncated them.  Cookbook runs now.  Phonebook did not, and no log was 
> written for the attempt to run it.  Not that I can find.

I am curious about this statement.  How did you arrange to have 
different projects write to the same log/development log?  You do not 
have multiple Rails projects in the same root directory perchance?
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-19 Thread Marnen Laibow-Koser

Dwight Shackelford wrote:
> Hassan Schroeder wrote:
>> On Sat, Jul 18, 2009 at 9:26 PM, Dwight
>> Shackelford wrote:
>> 
>>> No route matches "/cookbook" with {:method=>:get}
>> 
>>> I don't even know how to start diagnosing this.
>> 
>> Do all your unit/rspec tests still pass?
> 
> Don't know what that means.  I'm pretty new at this.
[...]

Whether you're new or not, you should be aware of Rails' testing tools, 
and you should be constantly writing tests, preferably before you write 
the code.  If you really don't know what Rails unit tests and/or RSpec 
specs are, then you must learn about these before you write even *one 
more line* of application code.  This is essential to good development 
practice.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-18 Thread Dwight Shackelford

Hassan Schroeder wrote:
> On Sat, Jul 18, 2009 at 10:57 PM, Dwight
> Shackelford wrote:
> 
 ActionController::RoutingError (No route matches "/cookbooks" with
 {:method=>:get}):
>>>
>>> OK, so what does `rake routes` for *this* application show?
> 
>> (in C:/InstantRails/rails_apps/cookbook)
> 
> o-tay -- so *exactly* as the error message says, there's no route
> "/cookbooks". That seems like a pretty unambiguous indicator :-)
> 
> So where and why are you calling that?
> 
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan

Looks like this is what brings up cookbooks:  http://localhost:3001/

not http://localhost:3001/cookbooks

I'll try to work on this tomorrow, with one of the projects I wrote. 
Cookbook came with the app.  Thanks for your help so far.  Let me get a 
bit more focused.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-18 Thread Hassan Schroeder

On Sat, Jul 18, 2009 at 10:57 PM, Dwight
Shackelford wrote:

>>> ActionController::RoutingError (No route matches "/cookbooks" with
>>> {:method=>:get}):
>>
>> OK, so what does `rake routes` for *this* application show?

> (in C:/InstantRails/rails_apps/cookbook)

o-tay -- so *exactly* as the error message says, there's no route
"/cookbooks". That seems like a pretty unambiguous indicator :-)

So where and why are you calling that?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-18 Thread Dwight Shackelford

Hassan Schroeder wrote:
> On Sat, Jul 18, 2009 at 10:46 PM, Dwight
> Shackelford wrote:
> 
>> Cookbook crashed again. �Here's the log, or the last part of the log:
> 
>> ActionController::RoutingError (No route matches "/cookbooks" with
>> {:method=>:get}):
> 
> OK, so what does `rake routes` for *this* application show?
> 

(in C:/InstantRails/rails_apps/cookbook)
 categories GET/categories 
{:action=>"index", :controller=>"categories"}
   formatted_categories GET/categories.:format 
{:action=>"index", :controller=>"categories"}
POST   /categories 
{:action=>"create", :controller=>"categories"}
POST   /categories.:format 
{:action=>"create", :controller=>"categories"}
   new_category GET/categories/new 
{:action=>"new", :controller=>"categories"}
 formatted_new_category GET/categories/new.:format 
{:action=>"new", :controller=>"categories"}
  edit_category GET/categories/:id/edit 
{:action=>"edit", :controller=>"categories"}
formatted_edit_category GET/categories/:id/edit.:format 
{:action=>"edit", :controller=>"categories"}
   category GET/categories/:id 
{:action=>"show", :controller=>"categories"}
 formatted_category GET/categories/:id.:format 
{:action=>"show", :controller=>"categories"}
PUT/categories/:id 
{:action=>"update", :controller=>"categories"}
PUT/categories/:id.:format 
{:action=>"update", :controller=>"categories"}
DELETE /categories/:id 
{:action=>"destroy", :controller=>"categories"}
DELETE /categories/:id.:format 
{:action=>"destroy", :controller=>"categories"}
recipes GET/recipes 
{:action=>"index", :controller=>"recipes"}
  formatted_recipes GET/recipes.:format 
{:action=>"index", :controller=>"recipes"}
POST   /recipes 
{:action=>"create", :controller=>"recipes"}
POST   /recipes.:format 
{:action=>"create", :controller=>"recipes"}
 new_recipe GET/recipes/new 
{:action=>"new", :controller=>"recipes"}
   formatted_new_recipe GET/recipes/new.:format 
{:action=>"new", :controller=>"recipes"}
edit_recipe GET/recipes/:id/edit 
{:action=>"edit", :controller=>"recipes"}
  formatted_edit_recipe GET/recipes/:id/edit.:format 
{:action=>"edit", :controller=>"recipes"}
 recipe GET/recipes/:id 
{:action=>"show", :controller=>"recipes"}
   formatted_recipe GET/recipes/:id.:format 
{:action=>"show", :controller=>"recipes"}
PUT/recipes/:id 
{:action=>"update", :controller=>"recipes"}
PUT/recipes/:id.:format 
{:action=>"update", :controller=>"recipes"}
DELETE /recipes/:id 
{:action=>"destroy", :controller=>"recipes"}
DELETE /recipes/:id.:format 
{:action=>"destroy", :controller=>"recipes"}
   root/ 
{:action=>"index", :controller=>"categories"}
   /:controller/:action/:id
   /:controller/:action/:id.:format
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-18 Thread Hassan Schroeder

On Sat, Jul 18, 2009 at 10:46 PM, Dwight
Shackelford wrote:

> Cookbook crashed again.  Here's the log, or the last part of the log:

> ActionController::RoutingError (No route matches "/cookbooks" with
> {:method=>:get}):

OK, so what does `rake routes` for *this* application show?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-18 Thread Dwight Shackelford


> I wiped the logs, because data from differing projects were getting 
> written to multiple logs, meaning a specific log under a specific 
> subdirectory included data from other projects too.  To get a clean run, 
> I truncated them.  Cookbook runs now.  Phonebook did not, and no log was 
> written for the attempt to run it.  Not that I can find.

Cookbook crashed again.  Here's the log, or the last part of the log:

Rendering 
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb
 
(not_found)


Processing ApplicationController#index (for 127.0.0.1 at 2009-07-18 
22:43:06) [GET]
  Session ID: 
BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%0ASGFzaHsABjoKQHVzZWR7AA%3D%3D--1fcc8bed80c5349246099b22244d1f5831fe8285
  Parameters: {}


ActionController::RoutingError (No route matches "/cookbooks" with 
{:method=>:get}):

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1441:in
 
`recognize_path'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1424:in
 
`recognize'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:170:in
 
`handle_request'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
 
`dispatch'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
 
`dispatch_cgi'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
 
`dispatch'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/rails.rb:76:in
 
`process'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/rails.rb:74:in
 
`synchronize'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/rails.rb:74:in
 
`process'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:159:in
 
`process_client'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:158:in
 
`each'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:158:in
 
`process_client'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:285:in
 
`run'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:285:in
 
`initialize'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:285:in
 
`new'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:285:in
 
`run'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:268:in
 
`initialize'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:268:in
 
`new'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:268:in
 
`run'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/configurator.rb:282:in
 
`run'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/configurator.rb:281:in
 
`each'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/configurator.rb:281:in
 
`run'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:128:in
 
`run'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/command.rb:212:in
 
`run'

C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:281
C:/INSTAN~2/ruby/bin/mongrel_rails:19:in `load'
C:/INSTAN~2/ruby/bin/mongrel_rails:19

Rendering 
C:/INSTAN~2/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb
 
(not_found)
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-18 Thread Dwight Shackelford

Hassan Schroeder wrote:
> On Sat, Jul 18, 2009 at 9:26 PM, Dwight
> Shackelford wrote:
> 
>> No route matches "/cookbook" with {:method=>:get}
> 
>> I don't even know how to start diagnosing this.
> 
> Do all your unit/rspec tests still pass?

Don't know what that means.  I'm pretty new at this.


> 
> Are there any errors in your logs?

I wiped the logs, because data from differing projects were getting 
written to multiple logs, meaning a specific log under a specific 
subdirectory included data from other projects too.  To get a clean run, 
I truncated them.  Cookbook runs now.  Phonebook did not, and no log was 
written for the attempt to run it.  Not that I can find.

> 
> What does `rake routes` show?

This is for phonebook

(in C:/InstantRails/rails_apps/phonebook)
  phonebooks GET/phonebooks 
{:action=>"index", :controller=>"phonebooks"}
formatted_phonebooks GET/phonebooks.:format 
{:action=>"index", :controller=>"phonebooks"}
 POST   /phonebooks 
{:action=>"create", :controller=>"phonebooks"}
 POST   /phonebooks.:format 
{:action=>"create", :controller=>"phonebooks"}
   new_phonebook GET/phonebooks/new 
{:action=>"new", :controller=>"phonebooks"}
 formatted_new_phonebook GET/phonebooks/new.:format 
{:action=>"new", :controller=>"phonebooks"}
  edit_phonebook GET/phonebooks/:id/edit 
{:action=>"edit", :controller=>"phonebooks"}
formatted_edit_phonebook GET/phonebooks/:id/edit.:format 
{:action=>"edit", :controller=>"phonebooks"}
   phonebook GET/phonebooks/:id 
{:action=>"show", :controller=>"phonebooks"}
 formatted_phonebook GET/phonebooks/:id.:format 
{:action=>"show", :controller=>"phonebooks"}
 PUT/phonebooks/:id 
{:action=>"update", :controller=>"phonebooks"}
 PUT/phonebooks/:id.:format 
{:action=>"update", :controller=>"phonebooks"}
 DELETE /phonebooks/:id 
{:action=>"destroy", :controller=>"phonebooks"}
 DELETE /phonebooks/:id.:format 
{:action=>"destroy", :controller=>"phonebooks"}
/:controller/:action/:id
/:controller/:action/:id.:format



-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error

2009-07-18 Thread Hassan Schroeder

On Sat, Jul 18, 2009 at 9:26 PM, Dwight
Shackelford wrote:

> No route matches "/cookbook" with {:method=>:get}

> I don't even know how to start diagnosing this.

Do all your unit/rspec tests still pass?

Are there any errors in your logs?

What does `rake routes` show?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error

2009-06-18 Thread Tyler Knappe

Tyler Knappe wrote:
> heimdull wrote:
>> I think the issue is that you have a general route to the checkout
>> controller and then you have a map.checkout route that is after the
>> map.resources :checkout route. so when you use checkout_path you will
>> get the edit task and not the checkout "route" that you have setup...
>> 
>> Try changing map.checkout to map.checkout-something-else and see if
>> that fixes the issue...
>> 
>> 
>> 
>> On Jun 17, 2:42�pm, Tyler Knappe 
> 
> You were on the right track.  What I had not realized was that 
> map.resources :controller generates the routes that I was seeing.  I 
> moved my map.checkout action to the top of the list and it now properly 
> calls the checkout controller's update function!

I was mistaken, I had changed how the Labs update action behaved.  I'm 
still having the same problem and I've changed all the routes around.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error

2009-06-18 Thread Tyler Knappe

heimdull wrote:
> I think the issue is that you have a general route to the checkout
> controller and then you have a map.checkout route that is after the
> map.resources :checkout route. so when you use checkout_path you will
> get the edit task and not the checkout "route" that you have setup...
> 
> Try changing map.checkout to map.checkout-something-else and see if
> that fixes the issue...
> 
> 
> 
> On Jun 17, 2:42�pm, Tyler Knappe 

You were on the right track.  What I had not realized was that 
map.resources :controller generates the routes that I was seeing.  I 
moved my map.checkout action to the top of the list and it now properly 
calls the checkout controller's update function!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error

2009-06-18 Thread Tyler Knappe

heimdull wrote:
> I think the issue is that you have a general route to the checkout
> controller and then you have a map.checkout route that is after the
> map.resources :checkout route. so when you use checkout_path you will
> get the edit task and not the checkout "route" that you have setup...
> 
> Try changing map.checkout to map.checkout-something-else and see if
> that fixes the issue...
> 
> 
> 
> On Jun 17, 2:42�pm, Tyler Knappe 

I think the problem lies here:

 def update
@lab = Lab.find(params[:id])

respond_to do |format|
  if @lab.update_attributes(params[:lab])
flash[:notice] = 'Lab was successfully updated.'
format.html { redirect_to(@lab) }
format.xml  { head :ok }
  else
format.html { render :action => "edit" }

If an unsuccessful update occurs the edit action is called, I changed 
this to another action and that action was called.  However, what I 
can't figure out is why this action is called from the Labs Controller, 
not from the Checkout Controller, where the checkout is called.  I have 
an update action in the Checkout Controller..
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error

2009-06-17 Thread heimdull

I think the issue is that you have a general route to the checkout
controller and then you have a map.checkout route that is after the
map.resources :checkout route. so when you use checkout_path you will
get the edit task and not the checkout "route" that you have setup...

Try changing map.checkout to map.checkout-something-else and see if
that fixes the issue...



On Jun 17, 2:42 pm, Tyler Knappe 
wrote:
> I have a problem with my routing.  When a user performs an illegal
> checkout action (end time < start time) it should route back to to the
> 'checkout' action.  However, it is instead going to the 'edit' action.
>
> 'rake routes' 
>
>  users GET    /users(.:format)                   {:controller=>"users",
> :action=>"index"}
>                   POST   /users(.:format)
> {:controller=>"users", :action=>"create"}
>          new_user GET    /users/new(.:format)
> {:controller=>"users", :action=>"new"}
>         edit_user GET    /users/:id/edit(.:format)
> {:controller=>"users", :action=>"edit"}
>              user GET    /users/:id(.:format)
> {:controller=>"users", :action=>"show"}
>                   PUT    /users/:id(.:format)
> {:controller=>"users", :action=>"update"}
>                   DELETE /users/:id(.:format)
> {:controller=>"users", :action=>"destroy"}
>       new_session GET    /session/new(.:format)
> {:controller=>"sessions", :action=>"new"}
>      edit_session GET    /session/edit(.:format)
> {:controller=>"sessions", :action=>"edit"}
>           session GET    /session(.:format)
> {:controller=>"sessions", :action=>"show"}
>                   PUT    /session(.:format)
> {:controller=>"sessions", :action=>"update"}
>                   DELETE /session(.:format)
> {:controller=>"sessions", :action=>"destroy"}
>                   POST   /session(.:format)
> {:controller=>"sessions", :action=>"create"}
>              labs GET    /labs(.:format)
> {:controller=>"labs", :action=>"index"}
>                   POST   /labs(.:format)
> {:controller=>"labs", :action=>"create"}
>           new_lab GET    /labs/new(.:format)
> {:controller=>"labs", :action=>"new"}
>          edit_lab GET    /labs/:id/edit(.:format)
> {:controller=>"labs", :action=>"edit"}
>               lab GET    /labs/:id(.:format)
> {:controller=>"labs", :action=>"show"}
>                   PUT    /labs/:id(.:format)
> {:controller=>"labs", :action=>"update"}
>                   DELETE /labs/:id(.:format)
> {:controller=>"labs", :action=>"destroy"}
>    lab_categories GET    /lab_categories(.:format)
> {:controller=>"lab_categories", :action=>"index"}
>                   POST   /lab_categories(.:format)
> {:controller=>"lab_categories", :action=>"create"}
>  new_lab_category GET    /lab_categories/new(.:format)
> {:controller=>"lab_categories", :action=>"new"}
> edit_lab_category GET    /lab_categories/:id/edit(.:format)
> {:controller=>"lab_categories", :action=>"edit"}
>      lab_category GET    /lab_categories/:id(.:format)
> {:controller=>"lab_categories", :action=>"show"}
>                   PUT    /lab_categories/:id(.:format)
> {:controller=>"lab_categories", :action=>"update"}
>                   DELETE /lab_categories/:id(.:format)
> {:controller=>"lab_categories", :action=>"destroy"}
>    checkout_index GET    /checkout(.:format)
> {:controller=>"checkout", :action=>"index"}
>                   POST   /checkout(.:format)
> {:controller=>"checkout", :action=>"create"}
>      new_checkout GET    /checkout/new(.:format)
> {:controller=>"checkout", :action=>"new"}
>     edit_checkout GET    /checkout/:id/edit(.:format)
> {:controller=>"checkout", :action=>"edit"}
>                   GET    /checkout/:id(.:format)
> {:controller=>"checkout", :action=>"show"}
>                   PUT    /checkout/:id(.:format)
> {:controller=>"checkout", :action=>"update"}
>                   DELETE /checkout/:id(.:format)
> {:controller=>"checkout", :action=>"destroy"}
>             login        /
> {:controller=>"sessions", :action=>"new"}
>            signup        /signup
> {:controller=>"users", :action=>"new"}
>         myaccount        /myaccount
> {:controller=>"myaccount", :action=>"myaccount"}
>            logout        /logout
> {:controller=>"sessions", :action=>"destroy"}
>                          /labs/checkout/:id
> {:controller=>"checkout", :action=>"checkout"}
>                          /labs/checkout/:id/update
> {:controller=>"checkout", :action=>"update"}
>          checkout        /labs/checkout/:id/edit
> {:controller=>"checkout", :action=>"update"}
>              root        /
> {:controller=>"home", :action=>"index"}
>                          /:controller/:action/:id
>                          /:controller/:action/:id(.:format)
>
> routes.rb:
>  map.checkout '/labs/checkout/:id', :controller => 'checkout', :action
> => 'checkout'
>   map.checkout '/labs/checkout/:id/update', :controller => 'checkout',
> :action => 'update'
>   map.checkout '/labs/checkout/:id/edit', :controller => 'checkout',
> :action => 'update'
>

[Rails] Re: Routing Error with Passenger for Images and stylesheets

2009-06-01 Thread John T.

John T. wrote:

> Oh, yeah, thought the config file would make it obvious. It's Apache 
> with Passenger. And I am pointing to the public directory:
> 
> Directory "/home/me/public_html/myapp/current/public

With thanks to Hongli Lai over on the Phusion Passenger Google Group, I 
got this sorted out. And for completeness and to help others this is 
what I did.

I set up a new directory under /var/www:

/var/www/myapp

and created a symlink from there to my app's public folder:

ln -s /home/me/public_html/myapp/current/public myapp

and changed my apache vhost file to be:


  ServerName myserver.com
  DocumentRoot /var/www/myapp
  
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
  
  RailsBaseURI /myapp


and made sure to include:

config.action_controller.relative_url_root = '/myapp'

in my environment.rb file.

Hongli's description:

> /var/www/myapp should be a directory. Inside this
> directory there should be a 'myapp' symlink. Like this:

> /var/www/myapp/
> /var/www/myapp/myapp -> /home/me/public_html/myapp/current/public

> When you say "RailsBaseURI /something", then Phusion Passenger will
> look for a filesystem entry "$DOCUMENT_ROOT/something", and this
> *must* be a symlink to the 'public' directory of your Rails app. 

Hope this helps someone else!

jt
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error with Passenger for Images and stylesheets

2009-05-31 Thread John T.

Steve Ross wrote:

> You didn't say what server you were using, but you need to point
> passenger to your *public* directory, not RAILS_ROOT as described
> here: 
> http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_to_a_virtual_host_8217_s_root
> 
> The Apache VirtualHost section they use as an example is:
> 
> 
>ServerName www.mycook.com
>DocumentRoot /weebapps/mycook/public
> 
> 
> They have a section on nginx if that's the server you are using.
> 
> Hope this helps.

Oh, yeah, thought the config file would make it obvious. It's Apache 
with Passenger. And I am pointing to the public directory:

Directory "/home/me/public_html/myapp/current/public
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error with Passenger for Images and stylesheets

2009-05-31 Thread s.ross


On May 31, 2009, at 8:30 AM, John T. wrote:
> John T. wrote:
>> Hi,
>>
>> I updated my server with the latest Rails (2.3.2) and Passenger  
>> (2.2.2).
>> I also updated my Rails app to run under 2.3.2. It runs
>> fine locally under Mongrel.
>>
>> The app is deployed into my own home directory under: (deployed via
>> Capistrano)
>>  /users/me/public_html/myapp/current   (which is a symlink to the
>> actual app)
>> and it's accessed by the url:
>>  http://myserver.com/myapp
>>
>> I was getting routing errors, where Passenger/Apache could not find  
>> the
>> default route. But I found a post saying Passenger
>> has an issue with routing, so I added the RailsBaseURI to the
>> environment.rb file:
>
> ...
>
>> Processing ApplicationController#index (for 1.2.3.4 at 2009-05-30
>> 13:11:46) [GET]
>>
>> ActionController::RoutingError (No route matches
>> "/stylesheets/scaffold.css" with {:method=>:get}):
>
> 
>
> Hate to bump my own post, but I really could use some input... nothing
> I've tried works.
>
> Thanks.
> -- 

You didn't say what server you were using, but you need to point  
passenger to your *public* directory, not RAILS_ROOT as described  
here: 
http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_to_a_virtual_host_8217_s_root

The Apache VirtualHost section they use as an example is:


   ServerName www.mycook.com
   DocumentRoot /weebapps/mycook/public


They have a section on nginx if that's the server you are using.

Hope this helps.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error with Passenger for Images and stylesheets

2009-05-31 Thread John T.

John T. wrote:
> Hi,
> 
> I updated my server with the latest Rails (2.3.2) and Passenger (2.2.2).
> I also updated my Rails app to run under 2.3.2. It runs
> fine locally under Mongrel.
> 
> The app is deployed into my own home directory under: (deployed via
> Capistrano)
>   /users/me/public_html/myapp/current   (which is a symlink to the
> actual app)
> and it's accessed by the url:
>   http://myserver.com/myapp
> 
> I was getting routing errors, where Passenger/Apache could not find the
> default route. But I found a post saying Passenger
> has an issue with routing, so I added the RailsBaseURI to the
> environment.rb file:

...

> Processing ApplicationController#index (for 1.2.3.4 at 2009-05-30
> 13:11:46) [GET]
> 
> ActionController::RoutingError (No route matches
> "/stylesheets/scaffold.css" with {:method=>:get}):



Hate to bump my own post, but I really could use some input... nothing
I've tried works.

Thanks.
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error

2009-05-06 Thread Sj Tib

> If you need more precise help, what web server and Ruby app server are
> you using on the production server?

Thanks and you are right. I need to configure my web server for this to 
follow symbolic links. I am using a Shared Accelerator on Joyent which 
has Apache as the web server and Mongrel for the Ruby app server. I am 
also browsing the discussion forums on Joyent. Thanks for any specifics 
you can provide on what needs to go there - I will keep that as 
reference based on what I find on Joyent forums.

-S
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error

2009-05-06 Thread pharrington

It sounds like whatever webserver you're using on the Production
machine (eg Apache, Nginx, etc) isn't actually handling the requests
for the requests for the static javascripts/stylesheets. In the case
of Apache (I don't have any real experience with anything else), make
sure that Options +FollowSymLinks is in your .htaccess or your vhost
container, and also depending on what Ruby app server you're using,
the appropriate rewrite directives are in place to only pass requests
to the app server for URI's that *do not* exists.

If you need more precise help, what web server and Ruby app server are
you using on the production server?

On May 6, 5:23 pm, Freddy Andersen  wrote:
> Why are the stylesheets and javascripts directories symbolic links on
> production?
>
> On May 6, 12:46 pm, Sj Tib  wrote:
>
> > Folks,
>
> > I am a little lost on a Routing error in accessing my javascripts and
> > stylesheets files on production and hopefully someone can help me.
>
> > Part of what is confusing me is that the same code that works fine on my
> > XP dev box is giving this Routing error when I put it up on the hosting
> > site in production environment. The only difference being the
> > environment itself (prod vs. dev) and that the javascripts and
> > stylesheets directories are symbolic links on production instead of
> > actual directories as on my local dev box.
>
> > For files like "/javascripts/path/to/my.js" and "/stylesheets/myapp.css"
> > I get error message like
>
> > ActionController::RoutingError (No route matches
> > "/stylesheets/myapp.css" with {:method=>:get}):
> > /vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisa 
> > tion.rb:66:in
> > `recognize_path'
>
> > I have looked at the routes.rb (included below) long enough but can't
> > see what is causing this Routing error.
>
> > I also started up a script_console and after loading up
> > ActionController::Routing::Routes in a variable the recognize_path for
> > "stylesheets/myapp.css" fails with the same error but it brings up the
> > page fine on that dev box without any errors - which is a little
> > confusing as well.
>
> > Here is what I have in my routes.rb
>
> >   map.resources :users, :collection => { :resetpwd => :get, :getnewpwd
> > => :get, :getpwdresetcode => :post }
>
> >   map.resource :session, :controller => 'session', :collection => {
> > :welcome_home => :get}
>
> >   map.root :controller => 'session', :action => 'new'
> >   map.activate '/activate/:activation_code', :controller => 'users',
> > :action => 'activate', :activation_code => nil
> >   map.resetpwd '/resetpwd/:resetpwd_code', :controller => 'users',
> > :action => 'resetpwd', :resetpwd_code => nil
> >   map.signup '/signup', :controller => 'users', :action => 'new'
> >   map.login '/login', :controller => 'session', :action => 'new'
> >   map.logout '/logout', :controller => 'session', :action => 'destroy'
>
> >   map.connect ':controller/:action/:id'
> >   map.connect ':controller/:action/:id.:format'
>
> > Sounds like I am missing something simple.
>
> > Appreciate any thoughts/pointers.
>
> > Thanks,
> > -S
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error

2009-05-06 Thread Sj Tib

I have over 3K files under javascripts (dojo library) that I don't want 
to deploy every time. Also, following the advice somewhere, given that 
javascripts/stylesheets/images don't change that often, it was 
recommended to put them in shared and create symbolic links from the 
deployed public directory.

Any thoughts on what could be causing the routing error?

-S

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing Error

2009-05-06 Thread Freddy Andersen

Why are the stylesheets and javascripts directories symbolic links on
production?

On May 6, 12:46 pm, Sj Tib  wrote:
> Folks,
>
> I am a little lost on a Routing error in accessing my javascripts and
> stylesheets files on production and hopefully someone can help me.
>
> Part of what is confusing me is that the same code that works fine on my
> XP dev box is giving this Routing error when I put it up on the hosting
> site in production environment. The only difference being the
> environment itself (prod vs. dev) and that the javascripts and
> stylesheets directories are symbolic links on production instead of
> actual directories as on my local dev box.
>
> For files like "/javascripts/path/to/my.js" and "/stylesheets/myapp.css"
> I get error message like
>
> ActionController::RoutingError (No route matches
> "/stylesheets/myapp.css" with {:method=>:get}):
> /vendor/rails/actionpack/lib/action_controller/routing/recognition_optimisa 
> tion.rb:66:in
> `recognize_path'
>
> I have looked at the routes.rb (included below) long enough but can't
> see what is causing this Routing error.
>
> I also started up a script_console and after loading up
> ActionController::Routing::Routes in a variable the recognize_path for
> "stylesheets/myapp.css" fails with the same error but it brings up the
> page fine on that dev box without any errors - which is a little
> confusing as well.
>
> Here is what I have in my routes.rb
>
>   map.resources :users, :collection => { :resetpwd => :get, :getnewpwd
> => :get, :getpwdresetcode => :post }
>
>   map.resource :session, :controller => 'session', :collection => {
> :welcome_home => :get}
>
>   map.root :controller => 'session', :action => 'new'
>   map.activate '/activate/:activation_code', :controller => 'users',
> :action => 'activate', :activation_code => nil
>   map.resetpwd '/resetpwd/:resetpwd_code', :controller => 'users',
> :action => 'resetpwd', :resetpwd_code => nil
>   map.signup '/signup', :controller => 'users', :action => 'new'
>   map.login '/login', :controller => 'session', :action => 'new'
>   map.logout '/logout', :controller => 'session', :action => 'destroy'
>
>   map.connect ':controller/:action/:id'
>   map.connect ':controller/:action/:id.:format'
>
> Sounds like I am missing something simple.
>
> Appreciate any thoughts/pointers.
>
> Thanks,
> -S
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error?

2009-04-09 Thread Ali

I figured it out.  I was using form_tag :action => 'update' instead of
form_for and that was causing the update statement to be incorrectly
assembled.

Thanks anyway!!

On Apr 9, 11:38 am, Ali  wrote:
> I hope this will be an easy question...
>
> I'm trying to migrate from Rails 1.2 to 2.1, and I must admit, the
> routing is somewhat confusing me.
>
> When I update a form, I'm getting a routing error.  ("No route matches
> {id}") It's because the update statement is getting assembled
> incorrectly somehow and the action is getting set to the id instead of
> "update"!  I don't understand how this is happening.  Does it have to
> do with routing?
>
> Here's my development.log showing what I'm talking about.
>
> Parameters: {"commit"=>"Save",
> "authenticity_token"=>"5d5f2530096051f30a11d94701281b54a537a012",
> "action"=>"13",
> "adminbillingrate"=>{"rate"=>"30", "employeetype_codeid"=>"119"},
> "controller"=>"adminbillingrates"}
>
> Any help would be appreciated as always!!
> ~Ali
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error in nested resources

2009-03-31 Thread Danimal

Hi Carlos!

Because of the nesting. For example, I recently hacked up a version of
Beast which is nested similarly to yours: Forums with many Topics with
many Posts. Creating a new post has the following resource path: /
forums/:forum_id/topics/:topic_id/posts/new
Even though the topic_id in my case is globally unique, it still needs
the forum_id for that path.

You don't have to do that, though. You could leave them as non-nested
and then just use associations, i.e. Topics has_many Items

I like nested resources conceptually but they do make url generation a
little confusing.

Just remember to use: "rake routes" liberally so that you always know
what routes are available and how to map them.

:-)

-Danimal

On Mar 31, 12:27 am, Carlos Santana 
wrote:
> Carlos Santana wrote:
> > I am using nested resources as follows:
> >   map.resources :topics do |topics|
> >     topics.resources :items do |items|
> >       items.resources :attachments
> >     end
> >   end
>
> > When I generate a RESTful path for new item in the console:
> > app.new_topic_item_path(2) then I get correct path as
> > '/topics/2/items/new'.
>
> > However, for the new attachment I am getting error:
> > app.new_topic_item_attachment_path(22) gives -
> > ActionController::RoutingError: new_topic_item_attachment_url failed to
> > generate from {:action=>"new", :controller=>"attachments",
> > :topic_id=>22}, expected: {:controller=>"attachments", :action=>"new"},
> > diff: {:topic_id=>22}
>
> >         from
> > /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:375:in
> > `raise_named_route_error'
> >         from
> > /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:339:in
> > `generate'
> >         from
> > /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:131:in
> > `rewrite_path'
> >         from
> > /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:110:in
> > `rewrite_url'
> >         from
> > /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:88:in
> > `rewrite'
> >         from
> > /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/integration.rb:218:in
> > `url_for'
> >         from (eval):17:in `new_topic_item_attachment_path'
> >         from (irb):5.
>
> > - - - - -
>
> > Why is it failing and how to fix this?
> > And, why is it generating '{:action=>"new", :controller=>"attachments",
> > :topic_id=>22}' ? Shouldn't it pass item_id rather than topic_id?
>
> > Any clues?
>
> > -
> > Thanks,
> > CS.
>
> Figured it out:
> I did new_topic_item_attachment_path and got an error:
> ''ActionController::RoutingError: new_agenda_item_attachment_url failed
> to generate from {:action=>"new", :controller=>"attachments"} - you may
> have ambiguous routes, or you may need to supply additional parameters
> for this route.  content_url has the following required parameters:
> ["agendas", :agenda_id, "items", :item_id, "attachments", "new"] - are
> they all satisfied?''
>
> So I need to pass both topic and item id. But isn't item associated with
> the topic resource? Why do I need to pass both ids?
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Routing error in nested resources

2009-03-30 Thread Carlos Santana

Carlos Santana wrote:
> I am using nested resources as follows:
>   map.resources :topics do |topics|
> topics.resources :items do |items|
>   items.resources :attachments
> end
>   end
> 
> When I generate a RESTful path for new item in the console:
> app.new_topic_item_path(2) then I get correct path as
> '/topics/2/items/new'.
> 
> However, for the new attachment I am getting error:
> app.new_topic_item_attachment_path(22) gives -
> ActionController::RoutingError: new_topic_item_attachment_url failed to
> generate from {:action=>"new", :controller=>"attachments",
> :topic_id=>22}, expected: {:controller=>"attachments", :action=>"new"},
> diff: {:topic_id=>22}
> 
> from
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:375:in
> `raise_named_route_error'
> from
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:339:in
> `generate'
> from
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:131:in
> `rewrite_path'
> from
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:110:in
> `rewrite_url'
> from
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:88:in
> `rewrite'
> from
> /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/integration.rb:218:in
> `url_for'
> from (eval):17:in `new_topic_item_attachment_path'
> from (irb):5.
> 
> - - - - -
> 
> Why is it failing and how to fix this?
> And, why is it generating '{:action=>"new", :controller=>"attachments",
> :topic_id=>22}' ? Shouldn't it pass item_id rather than topic_id?
> 
> Any clues?
> 
> -
> Thanks,
> CS.

Figured it out:
I did new_topic_item_attachment_path and got an error:
''ActionController::RoutingError: new_agenda_item_attachment_url failed 
to generate from {:action=>"new", :controller=>"attachments"} - you may 
have ambiguous routes, or you may need to supply additional parameters 
for this route.  content_url has the following required parameters: 
["agendas", :agenda_id, "items", :item_id, "attachments", "new"] - are 
they all satisfied?''

So I need to pass both topic and item id. But isn't item associated with 
the topic resource? Why do I need to pass both ids?


-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



  1   2   >