StudentsController extendeds my basic RESTful UsersController. Student
is a named_scope in my User model.
I''d like the students controller to render templates in app/views/
users/, not app/views/students/. How can I do this DRYly without
redefining all the methods in UsersController?
# entire students_controller.rb
class StudentsController < UsersController
protected
def find_users
@users = User.student.find(:all)
end
def find_user
@user = User.student.find(params[:id])
end
end
# relevant parts of users_controller.rb
class UsersController < ApplicationController
before_filter :find_users, :only => [:index]
def index
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end
#... other REST methods
protected
def find_users
@users = User.find(:all)
end
def find_user
@user = User.find(params[:id])
end
end
When I GET /students...
Template is missing
Missing template students/index.html.erb in view path /Path/To/MyApp/
app/views
In StudentsController I tried: append_view_path("/Path/To/MyApp/app/
views/users")...
Template is missing
Missing template students/index.html.erb in view path /Path/To/MyApp/
app/views:/Path/To/MyApp/app/views/users
Any ideas? Is there a better approach entirely? Perhaps some magic
routing?
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi, Anyone have used the "html to pdf convertors" on ruby. Thanks in Advance, Usha --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry wrong message, Please forgive for the inconvenience. On Wed, Jul 16, 2008 at 10:05 AM, Usha Murali <ushapramoth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Anyone have used the "html to pdf convertors" on ruby. > > Thanks in Advance, > Usha >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---