scope :completed, joins(:user).where(:todos => {:complete => true })
scope :logged, completed.where("todos.updated_at <= ?", 1.day.ago)
Use the regular todo part
<%= render @user.todos.logged =>
However, I want to The section _logged.html.erb shows these logged items. I just can’t figure out the correct way to pass the range result to a specific section.
Thank you
<%=render :partial=>'logged', :collection=>@user.todos.logged %>
Or, if you want to pass the entire array to an instance, then you This can be done
<%=render :partial=>'logged', :object=>@user.todos.logged %>
here In both cases, I guess your object will be called to record.
Assuming your section contains <%= logged.title%> you want to render for each item, so you can use the first Version.
I have been using an oscilloscope to display some information to show the completed and 24-hour to-do items
p>
scope :completed, joins(:user).where(:todos => {:complete => true })
scope :logged, completed.where("todos.updated_at <= ?", 1.day.ago)
Using the regular todo part
<%= render @user.todos.logged =>
However, I want to use a different part_ These logged items are displayed in logged.html.erb. I just can't figure out the correct way to pass the range result to a specific section.
Thank you
Well, if you want to render parts for each item, you can do this:
<%=render :partial=>'logged' , :collection=>@user.todos.logged %>
Or, if you want to pass the entire array to an instance, then you can do this
< pre><%=render :partial=>'logged', :object=>@user.todos.logged %>
In both cases, I guess your object will be called to log.
Assuming your section contains <%= logged.title%> you want to render for each item, so you can use the first version.
p>