Displaying 20 results from an estimated 43 matches for "phone_numb".
Did you mean:
phonenumb
2006 Aug 14
2
ActionPack: number_to_phone error
Question about the number_to_phone function as provided by rails in actionpack:
http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html
If I do this in my controller:
num = number_to_phone(params[:phone_number])
I get this error:
undefined method `number_to_phone'' for #<TicketsController:0xb7a2bfcc>
Whereas if I do this in my view:
<% phone_number = number_to_phone(@phone_number.phone_number) %>
<%= text_field ''phone_number'', ''phone_...
2006 May 09
11
model filter?
Hi All,
Is there a way to filter / modify the output of a model class before
it''s returned to controller/view that''s calling it?
Example: I have a field phone_number which I always want to preformat
using the number_to_phone() helper....
Any help is appriciated.
Thanks!
--
Posted via http://www.ruby-forum.com/.
2007 Nov 29
3
Stylistic preferences
What are people''s opinions on which of these two styles is better to
use?
1) before
---------------------------
module UserSpecHelper
include GenericSpecHelper
def valid_sms_attributes(phone_number="12345")
{ :phone_number => phone_number }
end
end
describe User, "with phone number" do
include UserSpecHelper
before(:each) do
@user = User.new(valid_sms_attributes)
end
it "should be valid" do
@user.should be_valid
end
it...
2006 Jul 05
0
Javascript repeating fields.
...o it, but it gets kinda messy and I want to use partials
for the repeating fields, but I can''t figure out how to do it in a DRY way.
Anyone got any ideas?
Here''s a concrete example:
Say you have a couple of database tables like this:
employees:
id
name
date_of_hire
employee_phone_numbers:
id
employee_id
phone_number
Now, say I want a page for editing an employee. Here''s a template:
edit.rhtml
<% form_for :employee, @employee, :url => {:action => ''update} do |f| %>
<%= f.text_field name %>
<%= f.date_of_hire %>
<input type=&qu...
2007 Feb 23
2
how to remove spaces from phone number
Hi,
I need to allow login based on the phone number. During the signup they
can give the number in any format with spaces, slash or (). But for
storing in database and then during login to compare I just want the 10
digit number. How can I remove the special char from phone number before
storing to db ?
Thanks.
--
Posted via http://www.ruby-forum.com/.
2006 Jul 31
3
getting the last four digits of a string or number
I want to trim down a phone number to the last four digits before saving
it to the db. How would I do this? For example, 800-555-1212 which
could also be 8005551212, i want to save just 1212 (last four digits)
only.
--
Posted via http://www.ruby-forum.com/.
2007 Jun 24
6
I only want one type of model returned from a multi_search
...cross
multiple models, but i only want it to return one type of model.
for example i have a page that lists out people. on this page it shows
email addresses and phone numbers. I want to be able to search by any
fields directly from the person model and search the fields from the
email_address and phone_number models, but I only want to get back
people.
person
has_many email_addresses
has_many phone_numbers
acts_as_ferret :fields => [:firstname, :lastname, :birth_date]
email_address
has_one person
acts_as_ferret :fields => [:email_address]
phone_number
has_one person
acts_as_ferret :fields =&g...
2008 Nov 04
3
Nester Resources, Routes and Class Inheritance
...and are basically companies with
the type field set to reference...
All companies can have a phone number associated with them, and phone
number is a different model...
I''m having trouble using the form_for method with a company that
happens to be an Applicant...
form_for( [ @company, @phone_number] )
tries to use the route applicant_phone_number however the only route
that exists is company_phone_number, which is the one I want to use...
I tried to create a route by creating a
map.resource :applicants, :has_many => phone_numbers
but there is no resource for Reference or Applicant onl...
2006 May 24
1
does select support arrays in a form with multiple models?
i have a one-to-many model (an addressbook of contacts with many phone
numbers). i want to represent a select element so that its name is an
array containing the phone_number id...
<select id="phone_number_1_location_or_kind"
name="phone_number[1][location_or_kind]">
<option value="Work">Work</option>
<option value="Home">Home</option>
<option value="Fax">Fax</option>
</se...
2007 Jul 12
0
is it possible to get id of the matched field?
i want to create link on the matched field:
f.e. i have person and phone models.
class Person < ActiveRecord::Base
has_many :phones
acts_as_ferret :fields => [:phone_numbers]
def phone_numbers
phones.collect{|phone| phone.number}
end
end
search result''s page lists out people with matched phone_numbers
highlighted.
i want to create link on matched phone_number to get edit_phone page,
for instance. So I have to get the id of the phone with matched
p...
2006 Feb 15
6
error_messages_for trouble
I am trying so learn how to do custom validations.
The validation works as expected, but I can''t get "error_messages_for"
to display.
How is the name of the object supposed to be formated?
Where is this object created, the model or controller?
What am I doing wrong here?
#### Model ########################
class MyFolder < ActiveRecord::Base
def validate
# validation
2005 Mar 10
1
Asterisk@Home, AMP, and Broadvoice
Egad, not again with Broadvoice! Anyhow, I recently installed AAH and
configured my TDM11B and got that and some SIP phones working. I still
have some issues to work out, etc, but my current problem is Broadvoice.
I have checked out all of the online resources, including the recent
list exchange about the recent changes made by Broadvoice. However, the
one thing I have found to be consitent in
2006 Oct 20
7
MVC and modules. Views telling models to behave
...f like, the view is bestowing instant, and temporary knowledge on the
model for the duration of the views run.
It seemed to me that this would be more objecty than say a helper that
formats a string
format_my_string( my_string )
Instead, in my view. Lets assume I have a Building class that has a
phone_number field
At the top of my view then
<% Building.include PhoneNumberFormat %>
The PhoneNumberFormat module could overwrite the getter methods of
phone_number, fax_number etc to provide me with some nice formatting.
Presumably I could also pass some parameters somewhere (not quite sure yet)
s...
2009 Jun 26
0
validates_uniqueness_of and MySQL enum type
I tried to check validates_uniqueness_of for a MySql enum type column
with a scope given, like this:
validates_uniqueness_of :phone_type, :scope => :user_id
And It didn''t work. When I check the SQL statement for doing this
validation, it is like this:
SELECT `phone_numbers`.id FROM `phone_numbers` WHERE
(`phone_numbers`.`phone_type` = BINARY '''' AND `phone_numbers`.user_id
= 23) LIMIT 1
phone_type was set to be "Home". If I try validates_uniqueness_of on
any other columns. it works fine. Could some please highlight me
what''s g...
2006 Apr 14
7
How to call a java function in rubyonrails method
Hi everyone,
I''m Italian and sorry for my english mistakes...
I''m developing a web-site using rubyonrails.
It''s REALLY COOL!
But I''m obliged to re-use some javascript functions.
Do you know where I can get the right documentation (and examples) in
order to integrate these two different environments?
Thanks,
Matteo.
--
Posted via http://www.ruby-forum.com/.
2008 Mar 19
2
Stub / Mock - A little guidance?
...g_info.address3
self.bill_to_city = billing_info.city
self.bill_to_country_code = billing_info.country_code
self.bill_to_state_province_code = billing_info.state_province_code
self.bill_to_postal_code = billing_info.postal_code
self.bill_to_phone_number = billing_info.phone_number
self.bill_to_extension = billing_info.extension
self.bill_to_fax = billing_info.fax_number
self.save ? true : false
else
true
end
end
Here''s the spec:
describe User, "when checking billing i...
2009 Sep 21
0
Polymorphic form
...d as the value on a hidden field.
class Contact
belongs_to :person
acts_as_list :scope => :person
validates_presence_of :type
validates_inclusion_of :type, :in => TYPES.map {|disp, val| val}
validates_presence_of :label
end
class PhoneNumber < Contact
#
# ...
#
validates_as_phone_number :value
validates_presence_of :value
validates_uniqueness_of :value, :scope => [:person_id, :type]
end
class Address < Contact
validates_presence_of :zip_addon_id
validates_uniqueness_of :value, :scope => [:person_id, :type]
belongs_to :zip_addon
end
Here''s one of the...
2006 May 09
7
polymorphic relation question
I am trying to get polymorphic relations to work for my app. What I am
trying to do is explained by this picture
http://iroll.org/code/
I can''t figure out the code for in the controller to create a new
phone_number and assign it to a person. I have tried everything I can
think of.
A) do my models look correct?
B) what would the commands look like in the console or a controller
action look like to save something to a person?
I have been messing with this all afternoon, I got the example in the
recipe bo...
2012 Sep 15
2
[RSpec Testing] Methods take two arguments
...it "Should have two arguments" do
file =
File.new("#{Rails.root}/public/pdf/templates/chbox.pdf")
user = User.create(:first_name => "mark", :last_name =>
"jhon", :account_number => "3442", :phone_number => "23333333")
create_pdf.should_receive(object,template).with(user,file)
end
end*
*
*how can I fix that?
Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, sen...
2006 Feb 19
2
Another "escaping" problem
Ruby 1.8.2, edge Rails (and 1.0), Mac OS X 10.4.3.
Here''s the SQL that gets generated for an eager load:
SELECT events.`id` AS t1_r0, events.`user_id` AS t1_r1, addresses.`id`
AS t0_r0, events.`name` AS t1_r2, addresses.`name` AS t0_r1,
events.`meet_at` AS t1_r3, addresses.`phone_number` AS t0_r2,
events.`created_at` AS t1_r4, addresses.`phone_service` AS t0_r3,
events.`location_id` AS t1_r5, addresses.`user_id` AS t0_r4 FROM
addresses [" LEFT OUTER JOIN addresses_events ON
addresses_events.address_id = addresses.id LEFT OUTER JOIN events ON
addresses_events.event_id...