Forum: Ruby on Rails Ruby on Rails w/Dreamhost - routes problem...I think.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Hunter (Guest)
on 2006-05-02 20:35
I am trying to deploy my first app on Dreamhost using Ruby on Rails.  I
followed the wiki, but I think I am missing something.  I think it may
be in my RoR code, but I am not sure.

My app runs fine when run as
http://localhost:3000/AddPatientVisit/addvisits

AddPatientVisit is the controller and addvisits is the form that posts
back to the controller.

I got rid of the index.html in public (it did get served up before I
deleted it).

I think my route is wrong, but I don't know how to direct it to the page
above.  I should point out that my controller doesn't have an index
method, just an action that is called by the addvisits.rhtml when the
user hits the "submit" button.

Here is my route:
map.connect '', :controller => "AddPatientVisit"

I am very much a noob at this, so thank you for your help!
Al E. (Guest)
on 2006-05-02 20:56
Hunter wrote:

> Here is my route:
> map.connect '', :controller => "AddPatientVisit"

It looks to me like you'll need

map.connext '', :controller => "AddPatientVisit", :action => "addvisits"

--Al Evans
Hunter (Guest)
on 2006-05-02 21:03
Al Evans wrote:
> Hunter wrote:
>
>> Here is my route:
>> map.connect '', :controller => "AddPatientVisit"
>
> It looks to me like you'll need
>
> map.connext '', :controller => "AddPatientVisit", :action => "addvisits"
>
> --Al Evans

Thank you for the reply.  I will try that.  I was thinking the action
had to be a method.  The controller has a method called
addvisit(singular) that I made part of the route originally.  All that
did was run w/o any parameters passed to it.

I post back here with my results.
Hunter (Guest)
on 2006-05-02 22:11
I tried that, but to no avail.  Instead I put my "addvisits" code into
an index.html file in the add_patient_visit folder in the app/views.

Now the appropriate page shows up, but when I click the submit button,
it can't find the action addptvisit

This setup works fine in webrick, so I am thinking it's a route problem
again?!?

Thanks!
Hunter (Guest)
on 2006-05-02 22:22
Hunter wrote:
> I tried that, but to no avail.  Instead I put my "addvisits" code into
> an index.html file in the add_patient_visit folder in the app/views.
>
> Now the appropriate page shows up, but when I click the submit button,
> it can't find the action addptvisit
>
> This setup works fine in webrick, so I am thinking it's a route problem
> again?!?
>
> Thanks!

Correction:  The method in my controller that I need invoked is
'addvisit'
Hates_ (Guest)
on 2006-05-03 02:59
> Correction:  The method in my controller that I need invoked is
> 'addvisit'

Have you setup your form tag properly?

<%= start_form_tag :controller => "AddPatientVisit", :action =>
"addvisits" %>
Hunter (Guest)
on 2006-05-03 04:27
Hates_ wrote:
>
>> Correction:  The method in my controller that I need invoked is
>> 'addvisit'
>
> Have you setup your form tag properly?
>
> <%= start_form_tag :controller => "AddPatientVisit", :action =>
> "addvisits" %>

Hi Hates_,

Thank you for the reply.  I used the code below, which works in
development, but I will try what you are suggesting.  Thanks!

<form name="myform" action="addvisit" method="post">

   Patient #1<%= check_box("patient", '1', {:checked => 'checked'},
"yes") %></br>
   Patient #2<%= check_box("patient", '2', {:checked => 'checked'},
"yes") %></br>
   Patient #4<%= check_box("patient", '4', {:checked => 'checked'},
"yes") %></br>
   Patient #8<%= check_box("patient", '8', {:checked => 'checked'},
"yes") %></br>
   Patient #9<%= check_box("patient", '9', {:checked => 'checked'},
"yes") %></br>

</br>

<input type="submit" value="Add Visits">

</form>
Hunter (Guest)
on 2006-05-03 06:06
Hates_ wrote:
>
>> Correction:  The method in my controller that I need invoked is
>> 'addvisit'
>
> Have you setup your form tag properly?
>
> <%= start_form_tag :controller => "AddPatientVisit", :action =>
> "addvisits" %>

Do these tags go outside or inside my <form>...</form> html tags?

Thanks!
Hunter (Guest)
on 2006-05-03 06:30
I used the code below, which works fine in WEBrick, but give me an
application error when moved to the webserver.


<html>

<head>


</br>

</head>
<body>
</br>




<%= form_tag(:controller => "AddPatientVisit", :action => 'addvisit') %>

   Patient #1<%= check_box("patient", '1', {:checked => 'checked'},
"yes") %></br>
   Patient #2<%= check_box("patient", '2', {:checked => 'checked'},
"yes") %></br>
   Patient #4<%= check_box("patient", '4', {:checked => 'checked'},
"yes") %></br>
   Patient #8<%= check_box("patient", '8', {:checked => 'checked'},
"yes") %></br>
   Patient #9<%= check_box("patient", '9', {:checked => 'checked'},
"yes") %></br>

</br>

<%= submit_tag("Add Visits") %>

<%= end_form_tag %>




</body>

</html>
Charlie B. (Guest)
on 2006-05-03 20:59
(Received via mailing list)
> My app runs fine when run as
> http://localhost:3000/AddPatientVisit/addvisits
>
> AddPatientVisit is the controller and addvisits is the form that posts
> back to the controller.
>
> Here is my route:
> map.connect '', :controller => "AddPatientVisit"


try map.connect '', :controller => "AddPatientVisit", :action    =>
'addvisits'

Charlie B.
www.recentrambles.com
Phillip H. (Guest)
on 2006-05-03 21:06
(Received via mailing list)
On 3/05/2006, at 2:30 PM, Hunter wrote:

> </br>

I hope you mean <br />, </br> isn't valid, and no form of <br />
should be inside <head>. I suggest you fix your HTML first...

> I used the code below, which works fine in WEBrick, but give me an
> application error when moved to the webserver.

An error. Good. _WHICH_ error? Copy/paste it. If there's just '500
internal server error' find the logs, they're in your rails
application, check production.log.

--
Phillip H.
removed_email_address@domain.invalid
http://www.sitharus.com/
This topic is locked and can not be replied to.