PDA

View Full Version : controllers and models and persistence...


bluetechnx
June 29th, 2005, 01:24 PM
ok, so i have like a total of 4 tables in a database with like 3 join tables...

the 4 tables all have a controller for each to do CRUD operations on the tables. I am currently trying to add a sort() method to a controller to do the following to the section table:

#in manage_section_controller.rb
def sort
@result = Section.find(:all, :order "building, room, instructor_id")
end

#in sort.rhtml
# plz excuse if <%= and <% are off...im rush typing..
<%= for row in @result %>
<% puts row %>
<%= end %>

But, when I load the page I get a "Not Found" error...

is this some sort of persistence issue? where I need to tell Rails in Application.rb what models need to be remembered with like:

model :section
model :user

any insights are welcome...

One last question, any controller has visibility to all models right? or am I wrong on that belief?

rob
June 29th, 2005, 01:35 PM
A not found error.. That's interesting.

Any more details, or does it just give a 404-type error? The reason I ask is if Rails can't find a method on a controller it will generally say that.

What do your error logs show?

Rob

bluetechnx
June 29th, 2005, 03:08 PM
the page says:

"Not Found"

method '/section_mananager/sort'
---------------------------------
Webrick (yadda yadda)

the log shows that the query goes through and the page is rendered. I'll post each later, but I'm not at my development computer right now.

But, one of my points is that the method is in the controller, and I have a .rhtml file in the proper view directory....