similar to: eager include associated count?

Displaying 20 results from an estimated 8000 matches similar to: "eager include associated count?"

2006 Jan 03
0
has_and_belongs_to_many include problem
hey, i have users who are in groups, and i have a search form, where i can search on group, user lastname, and user firstname. All this is also with pagination. these are my models class User < ActiveRecord::Base has_and_belongs_to_many :groups end class Group < ActiveRecord::Base has_and_belongs_to_many :users end in my controller i do this THIS works (but in need pagination) @users2
2006 Jul 22
3
refactoring commonly used aggregations
I have a number of models that use an aggregation to combine First Name, Middle Initial and Last Name and they have been working fine. I am looking to clean this up, DRY it if possible. I have things like this in application.rb class Clwholename attr_reader :first_name, :middle_initial, :last_name def initialize(first_name, middle_initial, last_name) @first_name = first_name
2006 Jan 19
2
Simple Ferret Questions
I am trying to use Ferret for searching for users based on first and last name. In my index, I am adding the first_name, last_name, and a full_name which is basically "#{first_name} #{last_name}". I am searching the index using something like the following query: INDEX.search_each(%Q/first_name:#{query}* OR last_name:#{query}* OR full_name:#{query}*/) do |doc, score| The problem I am
2006 Aug 07
3
wrong number of bind variables
I''m getting this error message since i moved alot of the database logic to the model. wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ? def self.authenticate(first_name, last_name, password) user = User.find(:first, :conditions => [''first_name = ? AND last_name = ?'']) if user.blank? Digest::SHA256.hexdigest(password +
2007 Aug 26
2
Multi-word query searching across columns
I''m trying to implement a basic name search on a People table with separate first_name and last_name columns. I am using the will_paginate plugin and have the following search method in the model: def self.search(search, page) paginate :page => page, :conditions => ["lower(last_name) like ? or lower(first_name) like ?",
2007 Nov 06
2
Why is this view spec failing?
I can''t figure out why I am getting a failure. It renders out fine in the browser. <h1>New member</h1> <%= error_messages_for :member %> <% form_for(:member, :url => members_path) do |f| %> <fieldset> <legend>Member Info</legend> <p><label for="member[first_name]">First Name:</label> <%=
2006 Aug 07
2
Bind variables error
wrong number of bind variables (0 for 2) in: first_name = ? AND last_name = ? I''m not sure why I"m getting this error ? def self.authenticate(first_name, last_name, password) user = User.find(:first, :conditions => [''first_name = ? AND last_name = ?'']) if user.blank? Digest::SHA256.hexdigest(password + user.password_salt) != user.password_hash
2006 Mar 30
6
MS SQL query strangeness for ActiveRecord in Rails
Hi, I am currently trying to move my rubyonrails app from Linux to Windows server utilizing MS SQL instead of MySQL due to "business" reason. All my listing screen utilize a drop down list in each column to allow user to "filter" the listing based upon the value chosen from the drop down list. In the controller, I used find() method but with customized parameters such as
2006 Aug 11
0
SQL sort
in my list action, I setup the sort parameters as folows : .. sort = case @params[''sort''] when "login" then "login DESC" when "first_name" then "first_name DESC" when "last_name" then "last_name DESC" end ... to be used in a ''sort_link_helper''
2010 Mar 26
2
How to read a xml file?
How to read a xml file? I have this XML source: ------------------------------------------------------- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fichas> <ficha> <nombre>Gabriel</nombre> <apellido>Molina</apellido> <direccion>Alfredo Vargas #36</direccion> </ficha>
2014 May 29
0
How to make the tests pass in an elegant way? Ruby on Rails
I am writing a rails app with my colleague who wrote a lot of the tests. He had to take a leave of absence due to a death in his family, and I am needing helps with changing the model so that the tests will pass in our spec file. Here is the model: class Worker < ActiveRecord::Base attr_accessible :first_name, :last_name has_many :writings end Here is the spec:
2006 Mar 20
2
AHHHhhhhh... has_and_belongs_to_many, that is going on?
I don''t have a class by the name of "ReviewersScoreCard", yet my many to many configuration looks as follows. And, these errors while running some simple test with ./script/console is giving me a headache: ./script/console Loading development environment. >> r = Reviewer.find_first => #<Reviewer:0x19d0a48 @attributes={"id"=>"1",
2010 Oct 05
2
Is it possible to query on virtual attributes?
I have a Person model with attributes first_name and last_name. I want to implement autocomplete search that looks that the entire name. Hence I have a method: def full_name self.first_name + " " + self.last_name end Is it possible for me to query on full_name and have rails match the first_name and last_name fields? I currently receive this error when I try, because full_name
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the console, but not from the view. I have the following: # partial schema create_table "users", :force => true do |t| t.string "login", :null => false t.string "first_name" t.string "last_name" t.string "email", :null => false
2006 Jul 14
1
creating a computed column with activerecord for to_xml
Hi. I have a question about activerecord, computed columns and to_xml. I have a simple model called person that has a first_name and a last_name field (and thus a first_name and last_name field in the Person table). When I :find a model and call to_xml, I would like the result to not only send back first name and last name as xml but also add an additional attribute called full_name that is
2014 Apr 21
0
Unpermitted Parameters - Rails 4
Hi, I'm using Devise (3.2.4), Rails 4 and I'm trying to signup. I have a Registration Controller where i do have: " def sign_up_params params.require(:user).permit(:email,:first_name, :last_name,:mobile, :birthday, :current_password, :password,:password_confirmation) end " and everytime i try to sign up I get the following message: Processing by
2006 May 17
5
text_field_with_auto_complete (newbie question)
I have the text_field_with_auto_complete woking on my user DB using last_name. so looking for ''ivanoff'' works great, but I can''t find ''john''. Plus I like to have ''last_name, first_name'' show up in the dropdown. what I can''t figure out is how to concat first_name and last_name to make a name and use that to look it. working
2005 Feb 05
4
Creating collections
I''m trying to create a form where a collection is created, using the example from the Rails 0.9.5 weblog posting: http://weblog.rubyonrails.com/archives/2005/01/26/rails-095-a-world-of- fixes-and-tweaks/ I''m having a bit of trouble. The controller currently looks like this: class StudentController < ApplicationController def new render_text @params.inspect
2005 Dec 20
1
Sending mail error
hey, i get this message when i want to send a mail 5.3.3 AUTH not available c:/ruby/lib/ruby/1.8/net/smtp.rb:680:in `check_response'' c:/ruby/lib/ruby/1.8/net/smtp.rb:582:in `auth_login'' c:/ruby/lib/ruby/1.8/net/smtp.rb:581:in `critical'' c:/ruby/lib/ruby/1.8/net/smtp.rb:581:in `auth_login'' c:/ruby/lib/ruby/1.8/net/smtp.rb:571:in `__send__''
2008 Jul 06
1
ActionView::Base.field_error_proc not getting an error field
In my User form I have standard field to get user record attributes (first_name, last_name and email) I also have a select drop_down to choose a role from an array first_name, last_name and email are user record attributes, but I defined the role name as a virtual attribute validates_presence_of :email, :last_name attr_accessor :role_name validates_presence_of :role_name, :if =>