Ruby on Rails Tuesday, September 30, 2014


On Monday, September 29, 2014 9:40:24 PM UTC+1, Ruby-Forum.com User wrote:

class UserController < BaseController
 before_filter :check_auth, :except => [ :getNotifications ]
 # more here...
 def getNotifications()
  getSession()
  # ...
 end
end

 
This strikes me as odd - I wouldn't usually call a parent controller's action explicitly. Either the base controller would implement some non action methods that I'd call or I'd call the base controller functionality via super. 

Having said that, it was my recollection that filters were handled by Action Controller's perform_action so I wouldn't have expected what you saw either

Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a63cfb5e-1006-4edb-968b-816b56c300fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails Monday, September 29, 2014

You would probably want to make a counter cache for tasks on the project (you can find out more here: http://api.rubyonrails.org/v4.1.1/classes/ActiveRecord/Associations/ClassMethods.html#method-i-belongs_to), and additional when retrieving tasks from the database, when you know you will need their project data, use eager loading (more here: http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations).

Michał.


On 30.09.2014 05:15, Austin York wrote:
In a todo list-style app, I have the following ActiveRecord model method:

class Task < ActiveRecord::Base
 
# ...
 
def project_name
    project
.tasks.length > 0 ? "#{project.name} - #{name}" : project.name
 
end
end

The idea is to provide additional project information if there are one or more tasks on the project.

However, when invoked regularly on views this creates performance concerns (especially with a growing data set).

What is the best way to optimize this query so that it doesn't create N+1 query type issues when invoked from "each" loops in the view?

(Feel free to post answers on StackOverflow).
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0c714b76-d9d0-4eee-9954-1c50779931bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ruby on Rails

Can anybody know the live streaming in rails please suggest me../yes\?

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ba47511049addee4cd976e5a5c1b8a43%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.