Displaying 20 results from an estimated 800 matches similar to: "Should receive field_for failing"
2013 Dec 10
2
form_tag + fields_for Rails 4
Hi There,
I''m trying to user fields_for inside a form_tag, but i can''t catch it
on my controller.
I just take some html code off to makes it easy to read
my view...
i''m using campuses_path(current_church, @campus) instead form_for
@campus, because my route is like
resources :campuses, :path => ":church/campuses"
<%= form_tag
2006 Oct 13
3
Validation errors in has_one/belongs_to relationships.
I have two objects, QuoteInput and Insured.
QuoteInput has one Insured and Insured belongs to QuoteInput.
I don''t understand what I''m seeing.
I assign an Insured to a QuoteInput. The Insured object has invalid
data.
I call save! on the quote input. QuoteInput has no validations.
I expect two things to happen - 1) an exception should be thrown,
indicating that there was a
2006 Nov 04
0
Check_box woes
I have a User model and an Address model.
A user has_many addresses, and an address belongs_to a user.
An address object for a user could be a billing, shipping or marketing address.
The way I''m tracking this is via the user attributes:
billing_adress_id, marketing_address_id and shipping_address_id in the
user table, which holds the relevant address id.
But in my form that allows a
2006 Jun 16
3
Does HABTM support non "id" FKs?
Quick question. Say I have a geographical database with counties and zip
codes where counties have and belong to many zip codes.
zip_codes (id, zip_code)
counties (id, name)
When I create the association table, the Rails way says to do the
following: counties_zip_codes (county_id, zip_code_id).
However, given that zip_codes.zip_code is itself a candidate key, I
would much prefer to do the
2011 May 17
0
Select not maintaining state on nested form with
I am using nested forms with multiple instances of various of the forms. The
problem I cant figure out is how to maintain state for the select between
postbacks. I am using ''options_from_collection_for_select'' and in this the
last param is to be the selected value, but given the dynamic nature, the
value is going to depend on the iteration of the form builder. If I manually
force
2005 Jan 29
4
problem with postback generator on 0.9.5
I''m trying to call the postback generator on rails 0.9.5. I''ve
installed the postback tarball into
gems/1.8/gems/rails-0.9.5/generators/postback as it seems like it is
supposed to be. At least, I installed the login generator the same way
and it works. But when I try to run it, I get this:
[carl@e236014 test]$ ruby script/generate postback
2009 Apr 16
0
how to convert the find_by_sql code to the find code
I want 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
2015 Sep 08
0
Multiple vacation
Op 8-9-2015 om 17:15 schreef Michele Locati:
> I'm using Dovecot 2.2.9 and I'm having problems configuring multiple
> vacation actions.
> The problem is that I'd like to have two different senders and two
> different messages, selecting the correct case by the recipient email
> address.
> I mean, if someone writes me to my email address "to-address1 at
2006 Apr 04
3
model validates twice in tests, produces duplicate errors
In my unit tests for my User model, I''m testing some validation cases.
What is really strange, and driving me crazy, is that in the unit
tests, it seems like the save method is causing my validations to
execute twice, and produce duplicate error messages. This is making my
tests fail (because I''m checking for the number of errors that I
expect). In the web browser, only one error
2009 Jun 23
2
syntax error, unexpected tINTEGER, expecting $end
Please help me solve the following error message:
syntax error, unexpected tINTEGER, expecting $end
I have this model:
Code:
1. class GeoDatum < ActiveRecord::Base
2. end
The database contains the table geo_data, which contains the zip_code
column, filled with zip codes. I get the above error when searching
for a zip code and the zip code exists in the table. Here is the
2008 Jul 09
4
Auto Postback in Ruby On Rails
in some other language have a concept e.i "auto postback"
So, in Ruby on rails is there any such option e.i "auto postback"
or same as "auto postback"
basically what i want ot do is that i have 2 select box
One for "Industry" and other for "Chemical"
1st we show all the industry in "Industry" select box.
if we select any 1 industry
2006 Mar 21
2
Sorting by computed temporary field
Hey all,
I''m rather new to Ruby and Rails (and not great with SQL), but I''m
developing a ride sharing app and would like to be able to sort on
something I don''t have stored.
I have users, events, and rides, each of which has a zip code. Events
have_many rides, and rides belong_to events.
When an event is selected, I''d like to be able to show a list of
2008 Dec 23
1
aggregate / tranpose data
Dear R-Users,
Suppose I have data in the following format:
CODE_NAME ZIP_CODE
John 12345
John 23456
John 34567
Jane 13242
Jane 22123
I want to transpose / convert it into:
CODE_NAME ZIP_CODE
John 12345,23456,34567
Jane 13242,22123
Any idea/pointer is appreciated.
2005 Mar 07
3
Tons of shiny new stuff
Ok despite this crazy flu which got me last week i was able to get
some coding done.
Here goes:
== Hieraki
Hieraki got plenty of improvements next to the rails 0.10 update. The
biggest new features are proper yaml, html and readme export. But
there are also plenty of new code improvements like the switch to my
favorite postback style for all controllers. Hieraki traditionally
serves as a demo
2005 Apr 25
1
Problems when using sweepers with postbacks
I''m using a cache sweeper class [1] to take care of some pretty complex
sweeping. However, there is a problem with the current implementation.
Namely, the sweeper gets called only when an action named in
cache_sweeper is called using GET. As many methods where sweeper would
be useful are using postback to send the form to the same action, this
causes the cache to get swept when
2005 Dec 01
0
problem with options_from_collection_for_select() need id not name
hey,
i need a select list with a id property and not name, cuz i just ajax with this
list and it checks on id not name
if @request.post? #called by ajax
if @request.xml_http_request? #called by ajax
@geotag_id=params[:geotag_id].nil? ? -2 : params[:geotag_id]
else
@geotag_id=params[:geotag][:id].blank? ? -1:params[:geotag][:id]
end
else
@geotag_id = -1
end
i use this
@geotags =
2006 Aug 14
1
Postback Action Problem
I was trying to use postbacks, but its not working.
def edit
@xxxx= xxxx.find_by_id(params[:id]) || xxxx.new
if request.post?
@xxxx.attributes = params[:xxxx]
redirect_to :list and return if @xxxx.save
end
end
I get the following error: SystemStackError in xxxxxController#edit
stack level too deep. The code of list is same as the code generated by the
scaffold
2012 Mar 22
1
Rspec not loading fixtures
I am taking over a code base and am trying to run the tests. I am
somewhat new to RSpec so this might be a trivial problem.
Basically I can tell that the fixtures are not getting loaded. All 100
tests fail with a similar error.
But I don''t know why. Below is the code, with my narrative with ***
before it... Can you see anything or give me a clue where to look. So
far I am coming up
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for
The System model has_many children.
If I do this in my haml template:
-form_for @system do |s|
=s.text_field :name
-s.fields_for :children do |child_fields|
=child_fields.text_field :name
all is fine. The fields_for iterates over all children and puts the
correct data in the fields.
But...what I
2006 Aug 14
1
What fields_for really for?
Hello everyone!
I have 3 models:
=== 1 ===
class Region < ActiveRecord::Base
has_many :districts
end
=== 2 ===
class District < ActiveRecord::Base
belongs_to :region
has_many :suburbs
end
=== 3 ===
class Suburb < ActiveRecord::Base
belongs_to :district
validates_numericality_of :region_id, :only_integer => true
end
In edit.rhtml for SuburbController I need to specify