The code sample you provided is very common and many respectful Rails
developers use it.
If we go out of the scope of Rails and start speaking very strictly
about MVC, then probably we can say that it is not actually the
controller's job to do that type of things. But I think that
render :update has its place in Rails also for a purpose. Until
render :update block gets bigger I think it's a matter of taste to
have it inside the action or move into the separate rjs file in the
views folder. Your peace of code looks not very different from simple
render :action => 'action_name' (I mean looks, but not how it works) -
and we don't say that it break MVC, that's why (IMHO) your code
doesn't break MVC too (it's too small to break anything :)). But it
can be a good practice to always create a separate rjs file for that
kind of things just in case you need to add more logic.
--
Thanks, Ivan Povalyukhin


On Dec 23, 4:18 am, deepak <[email protected]> wrote:
> I am using this function below which updates a div element with a
> partial in an ajax call.
>
> def publish
>   render :update do |page|
>     page.replace_html 'my_div', :partial => 'my_partial'
>   end
> end
>
> Does this approach breaks the MVC separation. If Yes, how can we avoid
> it?
>
> Thanks
> Deepak Kumar
> INDIA

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to