Ruby on Rails

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentRuby on Rails

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old May 5th, 2011, 12:23 AM
clem_c_rock clem_c_rock is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 33 clem_c_rock New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 3 h 33 m 46 sec
Reputation Power: 0
Restful routing seems excessive at times - I want to simplify

I'm still trying to get used to REST concepts and forms

I have a very simple controller that updates user profile data. I have this link that takes me to the controller:

<%= link_to('Profile', :controller => "operator_profile", :action => "edit") %>

I then want to simply display the operator's data like this:

def edit
@operator = Operator.find(current_operator.id)
end

and I want a form that posts to a update method in operator_profile. in my routes I have

resources perator_profile

I feel like I'm completely locked into the 7 base methods of REST and everything else throws routing errors

I couldn't even get the update method to work.

Can this be simplified?

Reply With Quote
  #2  
Old May 5th, 2011, 07:20 AM
clem_c_rock clem_c_rock is offline
Contributing User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 33 clem_c_rock New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 3 h 33 m 46 sec
Reputation Power: 0
Update:

I realized I should also attempt to go w/ a operations_controller instead of the operator_profile_controller. So I did that and I now have in routes:

resources perations

and in operations controller I have all 7 rest methods.

And now I'm getting this:

No route matches {:controller=>"operators", :action=>"edit"}

because of this link in application.html.erb:

<%= link_to('Profile', :controller => "operators", :action => "edit") %>

and this fails as well:

<%= link_to('Profile', :controller => "operators_profile", :action => "edit") %>

My model is operator.rb

Here's a dump of all my operator related routes:

Code:
      operator_profile_index GET    /operator_profile(.:format)                     {:action=>"index", :controller=>"operator_profile"}
                             POST   /operator_profile(.:format)                     {:action=>"create", :controller=>"operator_profile"}
        new_operator_profile GET    /operator_profile/new(.:format)                 {:action=>"new", :controller=>"operator_profile"}
       edit_operator_profile GET    /operator_profile/:id/edit(.:format)            {:action=>"edit", :controller=>"operator_profile"}
            operator_profile GET    /operator_profile/:id(.:format)                 {:action=>"show", :controller=>"operator_profile"}
                             PUT    /operator_profile/:id(.:format)                 {:action=>"update", :controller=>"operator_profile"}
                             DELETE /operator_profile/:id(.:format)                 {:action=>"destroy", :controller=>"operator_profile"}


                   operators GET    /operators(.:format)                            {:action=>"index", :controller=>"operators"}
                             POST   /operators(.:format)                            {:action=>"create", :controller=>"operators"}
                new_operator GET    /operators/new(.:format)                        {:action=>"new", :controller=>"operators"}
               edit_operator GET    /operators/:id/edit(.:format)                   {:action=>"edit", :controller=>"operators"}
                    operator GET    /operators/:id(.:format)                        {:action=>"show", :controller=>"operators"}
                             PUT    /operators/:id(.:format)                        {:action=>"update", :controller=>"operators"}
                             DELETE /operators/:id(.:format)                        {:action=>"destroy", :controller=>"operators"}

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentRuby on Rails > Restful routing seems excessive at times - I want to simplify


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap