search for: phone_numbers

Displaying 20 results from an estimated 43 matches for "phone_numbers".

Did you mean: phone_number
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: <%
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 =
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="...
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
...hat 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 => [:phone_number, :phone_type] multi_search(options[:query], ["EmailAddress", "Phon...
2008 Nov 04
3
Nester Resources, Routes and Class Inheritance
...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 only models, and thus it breaks down... I get errors. Any ideas on the correct way to make this work? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on R...
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
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 phon...
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
I was thinking today, it would be nice if a view could tell a model how to format it''s data for that particular view. Kind of 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
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 goin...
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?
Hi there, I''m still trying to wrap my head around when to use a stub and a mock. If I understand this right, I should be using a ''mock'' when imitating an object, but not its behavior. I should be using a stub when I want to imitate the behavior of an object. Does that sound about right? With that said, I''m struggling a little trying to spec out this instance
2009 Sep 21
0
Polymorphic form
I have two partials to deal with contact information. The Contact information uses single-table polymorphism. I want to be able to use save on Contact and set ''type'' manually, based on the type of form the user is filling in. This is saved as the value on a hidden field. class Contact belongs_to :person acts_as_list :scope => :person validates_presence_of :type
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
2012 Sep 15
2
[RSpec Testing] Methods take two arguments
Hello, Here is my *pdf_helper.rb* => http://pastebin.com/QU1kTKXk. I want to test, if self.create method can take more than two arguments. But, when I try to run my test. It showed *PdfHelper Should have two arguments Failure/Error: create_pdf.should_receive(object,template).with(user,file) NameError: undefined local variable or method `create_pdf'' for
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`