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


#1

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!


#2

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


#3

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.


#4

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!


#5

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” %>


#6

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!

Patient #1<%= check_box(“patient”, ‘1’, {:checked => ‘checked’},
“yes”) %>
Patient #2<%= check_box(“patient”, ‘2’, {:checked => ‘checked’},
“yes”) %>
Patient #4<%= check_box(“patient”, ‘4’, {:checked => ‘checked’},
“yes”) %>
Patient #8<%= check_box(“patient”, ‘8’, {:checked => ‘checked’},
“yes”) %>
Patient #9<%= check_box(“patient”, ‘9’, {:checked => ‘checked’},
“yes”) %>


#7

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’


#8

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

<%= form_tag(:controller => “AddPatientVisit”, :action => ‘addvisit’) %>

Patient #1<%= check_box(“patient”, ‘1’, {:checked => ‘checked’},
“yes”) %>
Patient #2<%= check_box(“patient”, ‘2’, {:checked => ‘checked’},
“yes”) %>
Patient #4<%= check_box(“patient”, ‘4’, {:checked => ‘checked’},
“yes”) %>
Patient #8<%= check_box(“patient”, ‘8’, {:checked => ‘checked’},
“yes”) %>
Patient #9<%= check_box(“patient”, ‘9’, {:checked => ‘checked’},
“yes”) %>

<%= submit_tag(“Add Visits”) %>

<%= end_form_tag %>


#9

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 … html tags?

Thanks!


#10

On 3/05/2006, at 2:30 PM, Hunter wrote:

I hope you mean
, isn’t valid, and no form of

should be inside . 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/


#11

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