Pallav_bfs
2012-Mar-28 11:54 UTC
How to use One controller''s CRUD methods from another controller?
In a sample app,we have one controller called employee_controller.This
one has its model and view parts.
Now can we create another controller(say,emp_controller,which
shouldn''t have model or view parts) in such a way that one can access
all employee''s methods through emp_controller.
That means,GET on http://server:3000/emp/{:id} would give same results
as a GET on http://server:3000/employee/{:id} would do?
Or,http://server:3000/emp/{:id}/skill/ would give same results as a
GET on http://server:3000/employee/{:id}/expertise/ would do?
[whereas emp is the controller mapping to employee and skill is the
controller mapping to expertise]
And I do not want to redirect to original urls(employee or employee/id/
expertise).
The new front-end urls with emp and skill controllers should be
sufficient to get tha data from original urls and show.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2012-Mar-28 12:06 UTC
Re: How to use One controller''s CRUD methods from another controller?
On 28 March 2012 12:54, Pallav_bfs <spallav88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> In a sample app,we have one controller called employee_controller.This > one has its model and view parts. > Now can we create another controller(say,emp_controller,which > shouldn''t have model or view parts) in such a way that one can access > all employee''s methods through emp_controller. > > That means,GET on http://server:3000/emp/{:id} would give same results > as a GET on http://server:3000/employee/{:id} would do? > > Or,http://server:3000/emp/{:id}/skill/ would give same results as a > GET on http://server:3000/employee/{:id}/expertise/ would do?Set up routes for those actions so that emp url goes to the appropriate employee controller actions. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.