Marcelo Cajueiro
2012-Aug-18 14:30 UTC
What do you guys think of "render nil" render nothing instead an error?
Hi guys, Today several apps are using presenters/decorators to extract some logic from the views and in some cases is a little hard to do that. Exemple: https://gist.github.com/e0d51f0c14501d58cbeb We can extract this to a helper but I think that would be great if we can do something like: https://gist.github.com/a1aa150cb730acadd824 With this way I think that''s easy and semantic form to do because make sense a `render nil` return nothing. What do you guys think? Can I do a pull request to the `render` stop to return: " ''nil'' is not an ActiveModel-compatible object that returns a valid partial path. " when we try to call `render` to `nil`? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/-HFfdBJNDkkJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Matt Huggins
2012-Aug-19 15:40 UTC
Re: What do you guys think of "render nil" render nothing instead an error?
I don''t think the reasoning necessarily justifies the desire to make `render nil` work. I say that because the examples you link to, specifically the second link, are relying on putting view-related logic into the model, which Rails is trying to steer away from. Any examples that demonstrate the need for passing nil without relying on view logic in the model? On Saturday, August 18, 2012 10:30:36 AM UTC-4, Marcelo Cajueiro wrote:> > Hi guys, > > Today several apps are using presenters/decorators to extract some logic > from the views and in some cases is a little hard to do that. > > Exemple: > > https://gist.github.com/e0d51f0c14501d58cbeb > > We can extract this to a helper but I think that would be great if we can > do something like: > > https://gist.github.com/a1aa150cb730acadd824 > > With this way I think that''s easy and semantic form to do because make > sense a `render nil` return nothing. > > > What do you guys think? > > Can I do a pull request to the `render` stop to return: > > " ''nil'' is not an ActiveModel-compatible object that returns a valid > partial path. " > > when we try to call `render` to `nil`? > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/j7tUSdt06nYJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Marcelo Cajueiro
2012-Aug-20 00:36 UTC
Re: What do you guys think of "render nil" render nothing instead an error?
Check out my first phrase. "Today several apps are using presenters/decorators to extract some logic from the views and in some cases is a little hard to do that." I''m not thinking of use a model method. On Sunday, August 19, 2012 12:40:19 PM UTC-3, Matt Huggins wrote:> > I don''t think the reasoning necessarily justifies the desire to make > `render nil` work. I say that because the examples you link to, > specifically the second link, are relying on putting view-related logic > into the model, which Rails is trying to steer away from. Any examples > that demonstrate the need for passing nil without relying on view logic in > the model? > > On Saturday, August 18, 2012 10:30:36 AM UTC-4, Marcelo Cajueiro wrote: >> >> Hi guys, >> >> Today several apps are using presenters/decorators to extract some logic >> from the views and in some cases is a little hard to do that. >> >> Exemple: >> >> https://gist.github.com/e0d51f0c14501d58cbeb >> >> We can extract this to a helper but I think that would be great if we can >> do something like: >> >> https://gist.github.com/a1aa150cb730acadd824 >> >> With this way I think that''s easy and semantic form to do because make >> sense a `render nil` return nothing. >> >> >> What do you guys think? >> >> Can I do a pull request to the `render` stop to return: >> >> " ''nil'' is not an ActiveModel-compatible object that returns a valid >> partial path. " >> >> when we try to call `render` to `nil`? >> >>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/P5T-CEylRxEJ. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.