similar to: does select support arrays in a form with multiple models?

Displaying 20 results from an estimated 10000 matches similar to: "does select support arrays in a form with multiple models?"

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/.
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 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 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
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 =
2010 Jan 21
2
Help with correct text file syntax EXCLUDE/INCLUDE + OPTION
Hi, Linux-Ubuntu here. English is not my first language. The man rsync is difficult to understand. I want to backup some folders recursively and some files, see [1] in my /home dir to an external USB HD (Ext4). I want to use a text file for the purpose. [1] /home/user/Documents /home/user/Software /home/user/.evolution/addressbook/local/system/addressbook.db
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
2006 Feb 08
5
Mysql::Error: Lost connection to MySQL server during query:
Hi, I am having Mysql connection problem for my first AddressBook application (which I took it from http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/) I have gem installed the latest ruby, rails, lighttpd, fastcgi, mysql-4.1.14 on linux. Everything looks good. When I do: mysql -h localhost -u test -ptest -D AddressBook mysql> SELECT COUNT(*) FROM contacts; +----------+ |
2006 Mar 06
2
is "alias" reserved?
I''m playing with an online store.... I have an orders table which holds orders (pricing, statuses, etc). An orderDetails table which holds detailed line items (itemNumbers, unit prices, etc). Each order can have multiple shipping addresses, so I also have an addressbook table. Each orderDetail is tied to an addressbook entry via the ordernumber and addressbook alias, but this
2006 Jul 05
0
Javascript repeating fields.
The one area I keep hitting my head against in Rails is repeating fields via javascript. I frequently have forms where one or more fields are actually broken out into sub tables because there can be multiple simultaneous values. Rails seems to want to you to use the [] construct in the form helpers (e.g. text_field(''employee[]'', ''name'')), but I can''t
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
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/.
2008 Dec 23
2
rails 2.2 connection to MySQL
I have been trying to connect to MySQL thru rails. Initially I had rails 2.1.2 and upgraded to rails 2.2 to use RestAPI in sproutcore. Once I have upgraded my rails version to 2.2, I have been getting this error. All I did is the following: 1. rails addressbook 2. cd addressbook 3. script/generate scaffold Contact first_name:string lastname:string 4. rake db:migrate I also change the
2008 Nov 04
3
Nester Resources, Routes and Class Inheritance
Ok here''s a quicky... but a goody :) We have models Company, Reference and Applicant... and References and Applicants just inherit from Company, 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
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
2004 Nov 07
2
Symlink file syncing issue
Hi! I've been attempting to use rsync to sync a set of files between my laptop and my desktop. I've tried using google to search the archives, but didn't find anything that addressed this issue exactly... First of all, here are the details of how I have things set up. Server acting as the intermediary: OS: Mac OS X Server 10.3 rsync: 2.6.2 Laptop: OS: Mac OS X 10.3.6 rsync: 2.6.2
2019 Mar 11
3
thunderbird addressbook with samba AD
Hi I am trying to make thunderbird addressbook works with my samba AD but with no success. I tried many articles about this but none of them work with my config. Does anybody made it with success ? Marius
2006 May 08
4
gsub no workie
Don''t know why, but cant seem to get this to work for me. I have a phone number field for an addressbook. In the addressbook model I have a before_update declaration that says the following: I''d like to be able to remove all special characters (just numbers please), but this doesn''t want to work for me. before_update :format_phone def format_phone self.phone =
2003 Aug 20
1
including file from excluded directory
I'm trying to explicitly include a file that exists under a directory that I otherwise want excluded. Here are my command and include list: rsync -e ssh -Cavz --delete --update \ --include-from=$HOME/.rsync.laptop . $DEST: where $DEST contains the remote machine name and this is being run from the top of my home directory. My include list is: + /.addressbook + /.ICAClient +
2008 May 10
4
from RubyCocoa to wxRuby ?
hey all, thanks to alex who help me to get the latest running on my box ( Mac OS X 10.4.11) to get it working download the latest gem locally cd to the directory where it lies and : $ sudo gem install --local wxruby u''ll get : Successfully installed wxruby-1.9.7-universal-darwin-9 1 gem installed ;-) A question, my first test will be to convert a RubyCocoa project into wxRuby. this