Displaying 20 results from an estimated 1100 matches similar to: "Nester Resources, Routes and Class Inheritance"
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 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
2006 Aug 11
6
Exporting to Excel ( all versions )
Hello,
Thanks in advance for reading.
I''m attempting to export data to an excel spreadsheet, and have done so
successfully using RubySpreadsheet (
http://sourceforge.net/projects/rubyspreadsheet/ ) which is a port of
the Perl WriteExcel module...
Many of the methods however were left out, one of them being
"insert_bitmap" and unfortunatley the bitmap is an important part
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/.
2008 Jun 13
6
Newbie question on has_many
I have two classes: a Widget and a User. The User has an id that is
referenced in two places on the Widget: owner_id and operator_id.
How should I structure that reference for has_many?
Thanks folks - I appreciate any help on this.
--David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2008 Mar 10
6
Probably OT, but CSS Help?
Ok I know this is off topic, but since you guys are usualy so helpful,
I thought I''d try here first.
Building a Rails App and one of the things we''ve done is put a CSS
class of;
* {
font-family:"Lucida Grande",verdana,arial,helvetica,sans-serif;
margin:0pt;
padding:0pt;
}
Now the problem is that the padding setting, for one reason or another
is killing my select
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 Aug 16
4
New Model Object from Existing Model Object
Hey Guys, need a hand again....
Lets say I have an Order... and an Order has Order Lines and Order_Lines
have Items...
I want to create a New Order, which would have New Order Lines with the same
Items...
Is there a fast / easy way to do this, w/o having to create a new order,
loop through all the order lines, and create them associating them with the
Items?
Any help would be great, thanks
--
2008 May 14
5
RailsConf vs. My MacBook's Battery. ( Power Outlet Availability )
So my Macbook''s battery sucks... and I''m thinking of grabbing a new
one, I''m curious how the availability of power outlets have been at
RailsConfs. For those who have gone before, was it hard to find an
outlet to plug into? Are they mindful of this?
I hope so.
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because
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 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/.
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
2007 Aug 15
4
Is there a automatic counter variable?
Does ruby have anything where if I''m going through a do-while loop, or
a "3.times" loop or "for product in products" where there''s a variable
that will tell me which iteration of the loop I''m on? Instead of
havign to declare my own counter = 0 and then increment it each time?
Seems like something Rails would have... I can''t seem to find
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/.
2006 Aug 16
5
validation on methods that aren''t part of the database.
using the Rails Recipes book, i went through the tutorial on setting up
authentication on a site. the tutorial was great, but it raises a few
questions.
the fields in the database are password_hash, and password_salt. the
tutorial creates another method for password that takes the value it was
given and hashes it and adds the 6 character salt at the end.
what if i want to perform validation
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 Jun 24
6
I only want one type of model returned from a multi_search
I am trying to use acts_as_ferret''s multi_search to search across
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
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
2006 Oct 13
5
Insert NULL into MySQL "time" not 00:00:00
Ok I''m not sure what I''m doing wrong, but I have a table that holds a
bunch of times, however when I don''t fill in the text box that passes
it''s input on to the variables, rails defaults to 00:00:00, which is
bad, because that''s midnight.
I''m pretty sure I''m doing somethign wrong, and I''m even thinking of
using the