Displaying 20 results from an estimated 100 matches similar to: "Polymorphic form"
2006 May 23
2
ActionMailer stopped working after upgrade to Rails 1.1
Hello,
I am using implicit e-mail templates to send HTML messages. I had no
problems till I have upgraded to Rails 1.1. Now the deliver_xxx method
just fails without *any* error message. No error or whatsoever (both
in development and production environments) exist in logs. Stranger
than that, a blank page is being displayed (according to logs, 0
length response, with 200 OK code). I googled for
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
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 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
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
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`
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
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
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
2006 Jun 24
3
Performance vs normalization best practice
I have a common situation and would like best practice suggestions from some
of you more experienced rails developers.
In my DB I''ve normalized tables in a traditional manner, e.g. I have Posts
which have authors stored in a Users table.
My problem is when I go to show a list of Posts and I want to display the
author name (e.g. post.author.name)
ActiveRecord appears to do a SELECT
2009 Oct 09
1
${REASON} not getting set.
Hi all,
I've got a program that creates a callfile and most if it working great.
However, when a call fails, I'm trying to capture the reason, which I'm told
should be in the ${REASON} channel variable.
http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out
Here is an excerpt from the callfile:
Channel: local/155555555
Callerid:Tests <155555555>
MaxRetries: 0
RetryTime:
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/.
2011 Apr 05
0
block method output is generating twice
write a block method to print a list
def column (&block)
if block_given?
content_tag(:li, capture(self, &block))
else
content_tag(:li, "")
end
end
and using it as
<%= data_list_for @leads, [" :10", "Age:30", "Contact:140", "Phone:
140", "Email:180", "Company:100", ""] do |l| %>
<%=
2008 Sep 04
0
MixMonitor + Originate
Hi everyone,
I'm trying to get calls to record with the following setup:
Using phpagi originate is called from a web application:
$asm->originate("Local/" . $row['extension'] . "@sip-standard",
$row['phone_number'], "sip-standard", "1", "", "", "7000");
The agent being called is extension Local/101 at
2005 Jul 20
0
Sipura 3000 x special dialling pattern (pin code)
I need to place a call using a "pin code". To access an external line,
the host PBX (a Ericsson MD-110) will require that I dial
*72*pincode#phone_number to complete any (trunk) call.
When I send the number, my Sipura 3000 will reject the call with
"Forbidden - wrong password on authentication for INVITE" (see below).
All other calls sent to the Sipura box without the
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 04
4
AJAX rendered select doesn''t get submitted
I have implemented the AJAX observe_field to filter the state/province options
in my address form. This works great except when I submit the form, @params
doesn''t contain the select element.
_address_form.rhtml relevant snippet:
<%= collection_select(:address, "country", Country.find(:all, :order =>
"position"), :code, :name, {:prompt => "-- Select
2010 Dec 15
2
skip password validation in authlogic
i am using authlogic for user authentication and authlogic-connect for
facebook and twitter signup.what i need is that i need to skip
validation on the password field if user is signup via facebook or
twitter.my environment is rails 3 and ruby 1.9.2.
i have acts_as_authentic in my user model.however i can skip phone
number validation like this
validates :phone_number, :numericality =>