similar to: How to call a java function in rubyonrails method

Displaying 20 results from an estimated 700 matches similar to: "How to call a java function in rubyonrails method"

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: <%
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 =
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/.
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
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
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 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
2006 Apr 06
2
Java: How to interact with ruby generated fields
Hello community, I''m new to rubyonrails and to this Forum. I have to call 2 Fields, generated by ruby, from a javafunction (onSubmit) but when I use this example it didn''t work, why? <%= start_form_tag({:action=> "show"}, { :onSubmit =>"post[testfieldone].value=examplefunction(post[textfieldtwo].value+post[textfieldthree].value);" }) %>
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
2005 Jul 13
1
syncing from the "file-list" option
Hello, all. I'm a begineer for rsync and please help me. I would like to sync data between two ftp sevrer. If one change/add/delete data usingf ftp, other ftp server should sync from the main ftp servert. In my thought, full data directory syncing is too slow, so if the client uses " --files-from" option, sync speed more fast than full data directory syncing. file list is
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
2005 Nov 11
2
Rsync, subversion and directories
Hi all, I'm attempting to build a backup system using rsync and subversion. I have a samba share which I would like to replicate via rsync. The replicated copy is under subversion control to store a 'history'. This appears to work well until a directory is removed on the primary (non-backup) file system. The rsync command which I assumed would do the job: $ rsyc -zrv
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 Jan 30
1
--files-from and --delete mutually exclusive?
Hi rsync developers, I'm trying to get some fancy mirroring done with selecting files from a larger archive through the --files-from option. The only problem that I do see is that rsync will not eat the --delete option whatever I try. Thus, all the old files remain in the mirror archive instead of being deleted. To be more clearly, I want the rsync --files-from option to behave like
2006 Apr 04
5
Database usage technique -- user-specified fields
Hello folks- In one particular app, it would be useful for the customers to be able to specify the significance (and presence) of fields. For example, consider a CONTACTs database. User 1 wants to have phone1, phone2, phone3, and User 2 wants to have 4 address fields. Generically, this could be done by having a CONTACT with, say, 10 strings, 10 integers, etc. The user''s account
2006 May 24
1
Placing call files in/var/spool/asterisk/outgoing/ does not work
> you should mv the file (and in the same filesystem, so 'rename' is used) > You might want to chmod or even chown the file first as well. I wrote a little script that does all of this before the .call file is mv'd into the outgoing directory: cp /tmp/test3.call /tmp/test1.call chmod 666 /tmp/test1.call chgrp asterisk /tmp/test1.call chown asterisk /tmp/test1.call mv
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
2005 Mar 16
5
Packet Counting...
Hi, How can i count the number of packets on an interface evry 2 or 5 seconds. and i want to count only specific packets like only arriving packets from port 5001 Any thoughts... Muhammad