Hi everyone!
I have one controller in app/comtrollers/AdminsController.rb
class AdminsController < ApplicationController
#with standart CRUD methods
def index
@admins = Admin.find(:all)
end
There are another one, that inherit his methods from parent:
class TurnirresultsController < AdminsController
def index
@admins = Turnir.find(:all)
super
end
Both have the same CRUD methods. It''s look very ugly. That''s
why I
inherited TurnirresultsController class from AdminsController.
view for "new" method looks like:
<div class="proz">
<% form_for(@admin) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :title %><br />ut
<%= f.text_area :title, :rows => 1, :cols => 103 %>
</p>
</div>
Usually, thay are using different tables.
I need to explore different views.
Here the problem:In this case the new Turnir object doesn''t create.
That''s why it doesn''t work.
I read cook book, looked in the net, but all finded articles didn''t
help me.
I tried whith routes.rb:
map.resources :turnirresults
but... you see, i''m here.
Please, Help me to find solution of this problem.
--
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.
Hi. It''s again me. I found article that helped me to solved this exercise: http://www.ruby-forum.com/topic/202398#new https://gist.github.com/280670 Sorry that I disturbed you. Bye.) -- 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.
On 3 March 2011 13:12, Vero <exe.shka.exe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi. It''s again me. > I found article that helped me to solved this exercise: > http://www.ruby-forum.com/topic/202398#newIf you''re looking to make your controllers DRYer, then you might benefit from one of the abstraction methods like "Inherited Resources" (https://github.com/josevalim/inherited_resources). It (and other similar methods) is a bit more flexible than just having the RESTful actions mapped by a common base class. HTH -- 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.
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-/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.