Displaying 20 results from an estimated 10000 matches similar to: "Non model cascading selects"
2012 May 28
4
How to load a selection list into the method new of a controller?
Hi friends!
I''m relatively new with Rails and I''m struggling for a long time with this
problem (it should have a pattern solution but until now I didn''t find it):
I have the following models: Institution, City, State and Country.
class Country < ActiveRecord::Base
has_many :states
has_many :cities, :through => :states
end
# == Schema Information
# Table
2006 Apr 12
22
Dynamic Select Box
Hi,
I''m new to rails/ruby having come from PHP and am just starting to get
my head round how easy it can be :)
However, can anyone point me in the right direction for dynamicaly
updating a select box based upon the choice of a previous select box,
without a page refresh.
Any and all help greatly appreciated.
Thanks
--
Posted via http://www.ruby-forum.com/.
2011 Apr 08
3
Ruby on rails migration problem
Hello all,
I have created a migration add_details _to users ... ( city_id ,
profession )
and then migrated it..
when i use params[:user] to update the database by taking user inputs
from forms in views, it is not updating the database for these city_id
and profession... ( not changing from null )
if add validation for presence of city_id .. it is giving the error
"City id cant be
2006 Aug 17
0
AJAX - Having Multiple SELECT (Drop Down), and dependency
Hi
I have three drop downs (State, City, Locality) and would like to
populate
City based on State selection and Locality based on City selection.
I have observers on two fields (State, and City). The observer_field on
state
works fine and it populates city based on state selection. But the
observer
on city doesn''t populate Locality. Now sure whats wrong with my code.
here is the
2006 Aug 16
8
Multiple (AJAX) Observers on the Same Field and MSIE
I have been using multiple observers, i.e., observe_field(), on the same
input field and relying on them to execute in the same order that they
appear in the page. This has been working fine in FireFox, but it does
not seem to work in MSIE; the requests come in and are processed in a
different order. Now, I''ve always been a little hesitant about using
this technique, but it always
2007 Oct 26
1
Custom method in Application Controller
Hi All,
I took this idea Christian Hellsten and Jarkko Laine''s "Beginning Ruby
on Rails E-Commerce".
Here is the situation. I will be using the
"options_from_collection_for_select" and "collection_select" form helper
methods in my view to render drop-down selection lists for City and
State that have corresponding city_id and state_id foreign key
references
2006 Jul 25
6
form and pagination question
Hello,
How do I get params from a form to use with a paginator?
debug(params) shows this
city: !map:HashWithIndifferentAccess
id: "1"
but in my controller, when I try to use
@hotel_pages = Paginator.new self, Hotel.count(:conditions =>
"hotels.city_id = params[:city][:id]"), 3, @params[''page'']
it doesn''t work. I suppose it''s a simple
2006 Apr 25
4
belongs_to :through
belongs_to :through
Why is that not possible?
We should have:
Street
belongs_to :city
belongs_to :country, :through => :city
--
Posted via http://www.ruby-forum.com/.
2006 Jan 31
2
Relationship navigation issue
class Event < ActiveRecord::Base
belongs_to :venue
belongs_to :category
end
class Venue < ActiveRecord::Base
belongs_to :city
end
class City < ActiveRecord::Base
belongs_to :state
end
I want to retrieve all event records belonging to a state. Coming from
hibernate background I tried something like this:
def self.list_for_a_state(state_id)
find_by_sql(["select e.*
2008 May 07
1
Assigning to the foreign key on a belongs_to association
I''ve encountered what seems like an odd omission in the behaviour of
belongs_to associations: if you assign to the foreign key attribute,
it doesn''t update the associated object (or mark a previously loaded
one as stale) until you explicitly save or reload it.
Let''s say we have a Company model, which belongs_to :city :
>> torchbox =
2006 Apr 04
4
Find records based on associated table''s colums
Hello,
Let''s say I have a model for a "house". Each house has_a "city", which
in turn has_a "state" which in turn has_a "country". The objective is to
retrieve all houses in a given state, say "Massachusetts".
Being new to Ruby on Rails what I like is that things that should be
simple usually are simple, and since we have easy access to
2006 Mar 22
4
Newbie - populating select list from db
Can''t seem to find an example of this anywhere - how do I populate a
select list in a form from a database?
I have a form to create a new task. The task is for a client, so there
should be a select list populated from my clients table. I thought this
would work:
<%= select ''task'', ''client_id'', Client.find_all, "id", "name"
2008 Dec 05
1
Question About Rails.cache and find method.
The DB load on my site is getting really high so it is time for me to
cache common queries that are being called 1000s of times an hour
where the results are not changing.
So for instance on my city model I do the following:
def self.fetch(id)
Rails.cache.fetch("city_#{id}") { City.find(id) }
end
def after_save; Rails.cache.delete("city_#{self.id}"); end;
def
2010 Feb 03
4
customizing validation msg
Hi,
i am using the default validation of RoR how i will customize them i
dont want to display the default message but i want to print the
message i want like for city_id the default message is "City can''t be
blank" i want this message as "Please enter city"
Regards
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2002 Sep 19
1
cascading Ogg Vorbis encoded audio
Hello, I am a grad student in the Music Engineering Technology program
at the University of Miami.
I am planning on doing thesis research on cascading audio encoding
chains and how to eliminate or improve audible artifacts in future
encoding generations and will potentially be using Ogg for this work.
My specific question is, Has anyone done any prior work in cascading
audio encoders? If so, it
2001 Feb 27
2
Cascading?
During the interesting interview that binaryfreedom has made with Monty
and Jack, Monty mentions cascading, a feature that will be added, quote:
"Cascading is the ability to make multiple passes through the frequency
spectrum, iteratively filling in more detail, like a progressive jpeg".
What are the advantages of something like this - does this generally
improves quality or is it used
2006 Aug 16
0
Multiple observer
Hi
I have three drop downs (State, City, Locality) and would like to
populate
City based on State selection and Locality based on City selection.
I have observers on two fields (State, and City). The observer_field on
state
works fine and it populates city based on state selection. But the
observer
on city doesn''t populate Locality. Now sure whats wrong with my code.
here is the
2006 May 18
3
populating array of text_fields from an array of model objects
I have in my view the following:
<% 0.upto(@num_performances) do |idx| -%>
<%= text_field ''performance'', ''city'', :index => idx, %>
<%= text_field ''performance'', ''venue'', :index => idx, %>
<% end -%>
and in my controller I have:
@performance = [Performance.new("city" =>
2007 Aug 20
0
FormBuilder in rjs
I have a page, which renders a partial that contains a ''State'' drop
down list. Upon change, it re-renders the ''City'' drop down, re-
populating it based on selected state_id:
Page: /customer/new.rhtml
<% form_for :customer, :url => customers_path do |f| %>
State: <%= f.collection_select :state_id, State.find(:all), ''id'',
2006 Jul 26
5
RoR data models ( extreme newbie question)
Sorry for asking this but I am keen to get on and build an app based on
RoR and have had a look around at FAQa and the like with no immediate
sucess.
What I am looking for is an explainantion of the rules/requirements for
table/index/coulumn names with RoR. RoR appears to have a set of
expected naming conventions which it would appear you can over ride but
it would seems a hell of a lot