Is it possible to render a partial with an action attached to it, just like the regular views? Or should I just call the action which renders the partial? -- Posted via http://www.ruby-forum.com/. -- 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.
Aldric Giacomoni wrote:> Is it possible to render a partial with an action attached to it, just > like the regular views? Or should I just call the action which renders > the partial?Uh...what? How does any view, partial or not, have an action attached? What in the world do you mean? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. --0022158df84f1bdf19047d346e0d Content-Type: text/plain; charset=ISO-8859-1 -- 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. --0022158df84f1bdf19047d346e0d--
Like a tile controller from the java world I would suppose. Essentially a block of code in an .rb file that gets executed every time the partial is rendered. I don''t think you can do that? Can you? On Fri, Jan 15, 2010 at 9:00 AM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Aldric Giacomoni wrote: > > Is it possible to render a partial with an action attached to it, just > > like the regular views? Or should I just call the action which renders > > the partial? > > Uh...what? How does any view, partial or not, have an action attached? > What in the world do you mean? > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- 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.
Marnen Laibow-Koser wrote:> Aldric Giacomoni wrote: >> Is it possible to render a partial with an action attached to it, just >> like the regular views? Or should I just call the action which renders >> the partial? > > Uh...what? How does any view, partial or not, have an action attached? > What in the world do you mean? >http://localhost:3000/Users/index That''s a view, right? In the controller, there''s "def index [...] end", right? That''s an action, right? So when you go to "index", Rails calls the Ruby method "index" in the appropriate controller, doesn''t it? -- Posted via http://www.ruby-forum.com/. -- 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.
Aldric Giacomoni wrote:> Marnen Laibow-Koser wrote: >> Aldric Giacomoni wrote: >>> Is it possible to render a partial with an action attached to it, just >>> like the regular views? Or should I just call the action which renders >>> the partial? >> >> Uh...what? How does any view, partial or not, have an action attached? >> What in the world do you mean? >> > > http://localhost:3000/Users/index > > That''s a view, right?No. That''s a URL. The view would be app/views/users/index.html.haml or some such.> In the controller, there''s "def index [...] end", right? That''s an > action, right?Right.> > So when you go to "index", Rails calls the Ruby method "index" in the > appropriate controller, doesn''t it?Assuming standard routing, yes. This does not make your original question any more comprehensible. :) Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. --0022158df84fa6a289047d349c28 Content-Type: text/plain; charset=ISO-8859-1 -- 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. --0022158df84fa6a289047d349c28--
James Englert wrote:> Like a tile controller from the java world I would suppose. > > Essentially a block of code in an .rb file that gets executed every time > the > partial is rendered. > > I don''t think you can do that? Can you?Of course you can. What do you think a helper is? Or a component?> > On Fri, Jan 15, 2010 at 9:00 AM, Marnen Laibow-KoserBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. --0015175cad8cb8bfbe047d34a08b Content-Type: text/plain; charset=ISO-8859-1 -- 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. --0015175cad8cb8bfbe047d34a08b--
2010/1/15 Aldric Giacomoni <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Marnen Laibow-Koser wrote: >> Aldric Giacomoni wrote: >>> Is it possible to render a partial with an action attached to it, just >>> like the regular views? Or should I just call the action which renders >>> the partial? >> >> Uh...what? How does any view, partial or not, have an action attached? >> What in the world do you mean? >> > > http://localhost:3000/Users/index > > That''s a view, right?No, it is a URL> In the controller, there''s "def index [...] end", right? That''s an > action, right? > > So when you go to "index", Rails calls the Ruby method "index" in the > appropriate controller, doesn''t it?You have it the wrong way round, clicking on the URI causes the index action to be performed, then that causes a view to be rendered. 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.
Well yes... That''s not really quite the same though... On Fri, Jan 15, 2010 at 9:14 AM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> James Englert wrote: > > Like a tile controller from the java world I would suppose. > > > > Essentially a block of code in an .rb file that gets executed every time > > the > > partial is rendered. > > > > I don''t think you can do that? Can you? > > Of course you can. What do you think a helper is? Or a component? > > > > > On Fri, Jan 15, 2010 at 9:00 AM, Marnen Laibow-Koser > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- 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.
you can render a partial in your action, or you can render your actions view and render a partial in it. http://api.rubyonrails.org/classes/ActionController/Base.html#M000658 <http://api.rubyonrails.org/classes/ActionController/Base.html#M000658>What can you tell me about the Tile thing? On Fri, Jan 15, 2010 at 5:57 AM, Aldric Giacomoni <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> Is it possible to render a partial with an action attached to it, just > like the regular views? Or should I just call the action which renders > the partial? > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- 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.
[Please quote when replying. This is a mailing list, not just a Web forum.] James Englert wrote:> Well yes... That''s not really quite the same though... > > On Fri, Jan 15, 2010 at 9:14 AM, Marnen Laibow-KoserWhere do you see the difference? You were asking about a block of Ruby code that is executed each time the view is rendered. That is *exactly* what a helper is. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. --0022158df84fca5fec047d34c691 Content-Type: text/plain; charset=ISO-8859-1 -- 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. --0022158df84fca5fec047d34c691--
Maybe I''m misunderstanding you. Your talking about putting a helper in a view, right? So <%= my_helper %> would be the code? On Fri, Jan 15, 2010 at 9:25 AM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> [Please quote when replying. This is a mailing list, not just a Web > forum.] > > James Englert wrote: > > Well yes... That''s not really quite the same though... > > > > On Fri, Jan 15, 2010 at 9:14 AM, Marnen Laibow-Koser > > Where do you see the difference? You were asking about a block of Ruby > code that is executed each time the view is rendered. That is *exactly* > what a helper is. > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- 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.
James Englert wrote:> Maybe I''m misunderstanding you. Your talking about putting a helper in > a > view, right? > > So > > <%= my_helper %> > > would be the code?Well, it would call FooHelper#my_helper, which would contain the code.> > On Fri, Jan 15, 2010 at 9:25 AM, Marnen Laibow-KoserBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. --00032555412a2bbf17047d351756 Content-Type: text/plain; charset=ISO-8859-1 -- 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. --00032555412a2bbf17047d351756--
Yeah. I got you. I guess the difference is really pretty trivial. With a "partial controller", you would define your code like this (made up code incoming): <%= render_partial ''some_partial'', :controller => ''SomeClass'' %> Rails would then call a method on SomeClass before it renders the partial. This would allow you to put some logic in SomeClass without adding any code to the view itself. The difference is simply semantic and not that important... Just trying to offer some understanding to the original question =] On Fri, Jan 15, 2010 at 9:48 AM, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> James Englert wrote: > > Maybe I''m misunderstanding you. Your talking about putting a helper in > > a > > view, right? > > > > So > > > > <%= my_helper %> > > > > would be the code? > > Well, it would call FooHelper#my_helper, which would contain the code. > > > > > On Fri, Jan 15, 2010 at 9:25 AM, Marnen Laibow-Koser > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- 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.
Marnen Laibow-Koser wrote:> Aldric Giacomoni wrote: >> Marnen Laibow-Koser wrote: >> >> So when you go to "index", Rails calls the Ruby method "index" in the >> appropriate controller, doesn''t it? > > Assuming standard routing, yes. > > This does not make your original question any more comprehensible. :) >When I go to the URI : http://localhost:3000/Ultrasounds/index I query a database for a list of ultrasounds and display that list under a button called "Fix ultrasounds". When I click that button, I want it to run the attached method, which it does, and I want that list to be re-queried and re-displayed. So, should I: 1) have this list displayed in a partial 2) the view set up with a div 3) in the "index" method, call the method which does the query, then renders the partial in that div 4) when the button is clicked, re-call the method which does the query and renders the partial in that div ? -- Posted via http://www.ruby-forum.com/. -- 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.