Displaying 20 results from an estimated 4000 matches similar to: "Errors object missing when saving AR in Web Services method"
2006 Jan 19
1
Model Validation & Floating Attributes
Hello all !
I have a model being validated that spits it''s error messages on the
resulting page using:
error_messages_for(:mymodel) .... Basic stuff. It''s working perfectly.
Now, I have something else I want to check on the same page (that isn''t an
attribute to the Model)... and am trying to add it using:
@mymodel.errors.add_to_base("another error here")
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
2006 Apr 07
1
Validate_presence_of error in nested object is not displayed
Hi,
I have a contact object . This contact has a address object
>>Contact
class Contact < ActiveRecord::Base
has_one :address
validates_presence_of :first_name ,:last_name
end
.>>> Address
class Address < ActiveRecord::Base
belongs_to :contact
validates_presence_of :address
end
Addres has the following fields ; address, phone, fax, email
In the contacts_controller I
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 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''
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> <%=
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 ?",
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
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>
2006 Jun 03
1
Can I tell if the associated record is new in a belongs_to save?
In a belongs_to association, is there a way to tell if the associated object
was newly created?
Hopefully this will explain my question:
A Firm class declares
has_many<http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000530>:clients
and a
client class declares
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 +
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 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
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",
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
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 Jul 28
1
Rails not using default database value when saving model
I setup a migration with a table that has a default value and can not be
null.
create_table( :user ) do |t|
t.column( :first_name, :string, {null => false} )
t.column( :last_name, :string, {null => false} )
t.column( :email_address, :string, {null => false} )
t.column( :last_login, :datetime, {:default => ''now()'', :null =>
false} )
end
It creates the
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