Displaying 20 results from an estimated 23 matches for "postal_code".
2006 May 24
4
AR foreign key problem.
Hello Railslist,
(I''m using RadRails 0.6.3 on Windows XP with Ruby 1.8.4, Rails 1.1 and SQLite3)
I have two tables in the database: "locations" and "customers":
customers.sql
---
id INT PRIMARY KEY
name VARCHAR 255
address VARCHAR 255
postal_code VARCHAR 255
city VARCHAR 255
---
locations.sql
---
id INT PRIMARY KEY
postal_code TEXT
longitude FLOAT
latitude FLOAT
---
I''ve created two models (customer.rb and location.rb):
customer.rb
---
class Customer < ActiveRecord::Base
belongs_to :location, :foreign_key=>''pos...
2008 Nov 01
2
stuck on a validates_presence_of unless issue
i have a person object. Persons don''t need to have addresses, but if
they have any address field value, they must have them all. So I have
something like this:
validates_presence_of :street_address, :city, :state, :postal_code
unless :address_blank?
address_blank? checks whether all of the address fields are blank.
If I run a test like this, it works:
describe "given attributes" do
before(:each) do
@valid_attributes = {
:first_name => "Jonny",
:middle_name => "...
2012 Aug 17
3
Rails doesn't validate create_model or build_model (has_one association)
..."✓",
"authenticity_token"=>"bA+KBkV1CQTyb3H8lH2dGyOl6YR+Lp2I9jQodxDjXlE=",
"shop"=>{"name"=>"", "primary_address"=>"", "secondary_address"=>"",
"city"=>"", "postal_code"=>"", "country_code"=>"", "phone"=>"",
"email"=>"", "website"=>"", "facebook"=>"", "twitter"=>"",
"opening_hours"=>"", &...
2009 Apr 16
0
how to convert the find_by_sql code to the find code
...nt to convert following query into pure ruby one i.e. by using find
@us_state_sales=SalesReport.find_by_sql("SELECT z.state,
sum(s.royalty_price) as royalty_price, sum(s.units) as units FROM
sales_reports s, zip_codes z
WHERE royalty_currency = ''USD'' && z.zip_code=s.postal_code GROUP BY
z.state ORDER BY royalty_price desc LIMIT 10")
i try something like this
@us_state_sales1=SalesReport.find(:all, :select=>" zip_codes.state,
sum(sales_reports.royalty_price) as royalty_price,
sum(sales_reports.units) as units",
:joins=>''zip_codes'&...
2012 May 04
3
Database schema question
...sers can have_many occassions.
How would i set this up in my models? So far i have:
class Reminder < ActiveRecord::Base
attr_accessible :date, :name
belongs_to :user
end
class User < ActiveRecord::Base
attr_accessible :address, :birthday, :city, :email, :gender, :interests,
:name, :postal_code
has_many :reminders
end
Thanks!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/lDjtqP256lQJ.
To post to this group, send email to ru...
2006 Apr 17
1
Autocompleter to read value from hidden field
...database with
approx. 100,000 road names).
To limit the number of roads, i want an extra input field where to put
postal code.
I''m currently using <%= text_field_with_auto_complete %> for the field.
What is the best way in Rails to intercept the Ajax call and send the value
of the postal_code field?
(I guess I could do it by hand, but I think that there is a smarter way of
doing this).
Thanks!
--
--
Jesper R?nn-Jensen
+45 23 73 62 20 (Mobile)
http://justaddwater.dk/ (weblog)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/...
2006 Apr 23
2
Rails Recipes
...le :contacts do |t|
t.column :name, :string
t.column :email, :string
t.column :phone, :string
t.column :address_line1, :string
t.column :address_line2, :string
t.column :city, :string
t.column :state, :string
t.column :country, :string
t.column :postal_code, :string
end
end
def self.down
drop_table :contacts
end
end
--
Posted via http://www.ruby-forum.com/.
2006 Oct 11
1
Polymorphic Validations
...guidance.
I''ve got a Polymorphic association for Addresses (which can belong to
two different models).
The catch is, one model requires a strict, precise address, and the
other only requires a City, State and Postal Code.
I want to use :validates_presence_of :street, :city, :state, and
:postal_code, but only if the instance is being assigned to the model
requiring stricter address validation.
Any thoughts?
-Jared
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to...
2008 Jul 06
1
GeoKit / Form Validation
...2) In using the GeoKit plugin I am attempting to use the
acts_as_mappable piece so when I create an address it adds the lat and
lng to the DB. If I choose just 1 field and specify it this works fine
and the table populates, but I want to concat all of the form values
(Street_Address_1, City, State, Postal_Code, Country) and pass these
in as the location. It appears GeoKit expects address to be a single
field - which will not work for my application. I am not opposed to
using another plugin, it just seems GeoKit is overall the easiest.
Any help would be greatly apperciated, and please go easy on me, I am...
2008 Mar 19
2
Stub / Mock - A little guidance?
...ling_info.address2
self.bill_to_address3 = billing_info.address3
self.bill_to_city = billing_info.city
self.bill_to_country_code = billing_info.country_code
self.bill_to_state_province_code = billing_info.state_province_code
self.bill_to_postal_code = billing_info.postal_code
self.bill_to_phone_number = billing_info.phone_number
self.bill_to_extension = billing_info.extension
self.bill_to_fax = billing_info.fax_number
self.save ? true : false
else
true
end
end
Here...
2007 May 04
2
Custom Matcher and NAME NOT GENERATED annoyance
...not be valid without first_name
- should not be valid without last_name
- should not be valid without login
- should not be valid without email
- should not be valid without password
- should not be valid without password_confirmation
- should not be valid without city
- should not be valid without postal_code
- should not be valid without country
- should not be valid with duplicate login
- should not be valid with duplicate email
(I omitted the second description).
Anyway, the problem started with latest release, which if someone my
matcher shows a problem, NAME NOT GENERATED was put in the descripti...
2006 Aug 10
4
exporting vcards from rails
i''m doing a site for someone that has a form set up to collect contact
information from the user. i installed the vpim gem and was hoping to
give my client a way to download all of the contact''s information as a
vcard. using the examples, i was able to get it working in ruby, but i''m
not quite sure how to generate and download a vcard on the fly.
has anyone done
2011 Mar 10
4
Multi-model forms
...td><%= address_form.label :state, ''State:'' %></td></tr>
<tr>
<td><%= address_form.text_field :state, :class => ''textfield''
%></td>
</tr>
<tr><td><%= address_form.label :postal_code, ''Postal Code:'' %></
td></tr>
<tr>
<td><%= address_form.text_field :postal_code, :class =>
''textfield'' %></td>
</tr>
<tr>
<td><%= address_form.label :country %></t...
2006 May 11
1
[Globalize] Enhancement - zip code regexes for each country
Was just playing around with trying to sort out validation of zip/postcodes
depending on what country the user lived in, and was wondering if anyone has
done this in a nice way? Seems to me that it would be a relatively simple
addition to Globalize to add a regex for zip code validation to the things
already in there?
Or am I missing a trick?
Thanks
geoff
-------------- next part --------------
2006 Jan 12
1
Overriding the initializer
Hi,
A question that I have been thinking about is.. by the time the
initialize method is called, has the instance of the object already been
created?
I''ve been thinking of creating a class object that would only have one
given instance based on a given attribute (ie: a "Town" object, whereby
only 1 town can exist in the entire table with a particular postal code)
but to
2014 Feb 06
0
Array Confusion
...cal"]}, {"long_name"=>"United States", "short_name"=>"US", "types"=>["country", "political"]}, {"long_name"=>"94043", "short_name"=>"94043", "types"=>["postal_code"]}], "formatted_address"=>"1600 Amphitheatre Parkway, Mountain View, CA 94043, USA", "geometry"=>{"location"=>{"lat"=>37.4219985, "lng"=>-122.0839544}, "location_type"=>"ROOFTOP", "viewport&q...
2008 Jun 18
1
Vpim gem
On Wed, Jun 18, 2008 at 6:32 AM, Joost Hietbrink <joost at joopp.com> wrote:
> Hi Sam Roberts,
> First of all. Thanks for the Vpim gem. We use it at www.yelloyello.com and
> it works great.
I''m glad to hear that.
> We''ve only encountered the following error:
> # NoMethodError (undefined method `to_str'' for []:Array):
> #
>
2006 Feb 04
4
AJAX rendered select doesn''t get submitted
...sword"=>"", "email"=>""},
"x"=>"48", "y"=>"10", "action"=>"create_account", "controller"=>"breeder",
"address"=>{"city"=>"", "postal_code"=>"", "country"=>"US", "street_ext"=>"",
"street"=>""}}
2006 Jan 30
3
Arrays of objects as parameters to webservices
I think I am missing something terribly obvious. Is it possible to have
an :expects parameter for a webservice that is an array of objects? I
want to have a single webservice that expects all my line items (for an
order). Is this something that is possible?
--
Posted via http://www.ruby-forum.com/.
2010 Jul 01
25
Encoding problems with Rails 3 + Ruby 1.9.1 (big surprise)
...ncompatible character encodings: ASCII-8BIT and UTF-8 (on the same
line as f.select :state)
If one of the fields AFTER the state field (like the postal code)
contains a non-ASCII character the error is reversed:
incompatible character encodings: UTF-8 and ASCII-8BIT (on the same
line as f.select :postal_code)
The more I work with encodings in Rails and Ruby in general, the more
I find myself confused and frustrated. I added config.encoding =
Encoding::UTF_8 to my application.rb, but that doesn''t appear to
affect templates at all. The problem, so far as I can see, is in one
of two places:
I e...