On 22.02.2012, at 6:33, Soichi Ishida wrote:

> Rails 3.1.3
> 
> I have tables, Video and Script having association,
> 
>   <%= render :partial => "create_or_update_script",
>  :locals => { :script => Script.find_or_create_by_video_id(:video_id =>
> @video.id)} %>

.find_or_create_by_video_id(@video.id)


But in general, operating any ActiveRecord model from a view is a bad idea 
because of rendering speed. All models should be ready to be accessed before 
ActionView - in controller - that would be much much faster.



-- 
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