When a nested form submitted to the create action contains missing
data, the form is redisplayed and the nested values the user entered
remain. When submitting the same nested form to the update action,
the newly entered values remain for the parent record, but the child
records revert back to
On Mar 25, 12:07 am, MaggotChild hsomob1...@yahoo.com wrote:
Is it possible to retain nested data across form redisplays to the
update action?
Anyone?
The answer appears to be no, given the Rails Guides example and the
Complex Forms Examples: github.com/alloy/complex-form-examples/tarball
Most in the Rails community seem stick with 1 controller per resource
when using RESTfull routes.
This makes sense for a resource with one scope and one view, but once
a resource is used with multiple scopes and/or views the amount of
code duplication needed to manage these in a single controller
I'm curious how people put static files uploaded by users to their
asset host.
I'd think (for non S3, CloudFiles, etc...) that the files would be
submitted to the app server which would save them to a shared drive on
the asset host. I've head bad things about NFS and high volume sites.
Is Samba
It seems that when a HABTM (or has many) is involved, having a
confirmation page prior to saving doesn't work as seamlessly as other
Rails view/model parings, specifically when confirming an edit. This
is caused by the immediate inserts or deletes that take place upon
assigning to collection_ids.
On Dec 31, 11:08 am, MaggotChild hsomob1...@yahoo.com wrote:
def preview
@product = Product.find params[:id]
@product.attributes = params[:product] #no product
I meant that no provider_ids are included in params
--
You received this message because you are subscribed to the Google
current_page?(:action = 'edit', :controller = 'admin/products')
fails with an ActionView::TemplateError (No route matches ...) unless
I'm in the edit action or I provide the :id.
Route:
/admin/products/:id/edit(.:format) {:action = 'edit', :controller =
'admin/products'}
I understand why this
I thought I had read somewhere why db:test:purge continues to use
`osql` but all I could find is this:
http://dev.rubyonrails.org/ticket/7054
Obviously this never made its way into Rails. Why? What are people
doing for MS SQL testing on non Windows OS'? Everyone's hacking their
own workaround?
When modifying a model that has a has_one or has_many relationship
people usually create form that will submit the id of the selected
associated object. Rails takes this into consideration with
validations: validate_presence_of :country will validate if country
or country_id has been set.
In
On Nov 14, 2:42 am, Leonardo Mateo leonardoma...@gmail.com wrote:
On Sat, Nov 14, 2009 at 6:37 AM, MaggotChild hsomob1...@yahoo.com wrote:
In Rails, providing the associated ID works fine with has_one but if
you try to do this with a has_many:
form_for(@country) do |form|
form.select
In a many-to-many relationship, defined via has_and_belongs_to_many,
accepts_nested_attributes_for deletes the wrong record(s) when
marked_for_destruction? == true.
For example:
class Ho AR
has_and_belongs_to_many :strolls, :join_table = :ho_strolls
accepts_nested_attributes_for :strolls,
On Oct 15, 12:22 am, Frederick Cheung frederick.che...@gmail.com
wrote:
On Oct 15, 3:13 am, MaggotChild hsomob1...@yahoo.com wrote:
dont_select_me is included. The docs say nothing of about :select
being stepped on by fall back left joins (not the :include!). This
seems like a bug
Well
I only want to select certain columns when eager loading an
association:
class Package ActiveRecord::Base
has_many :deliveries,
:select='id, name, region_id, package_id', #exclude text
column dont_select_me
:include=:region
end
class Delivery ActiveRecord::Base
On Oct 8, 4:25 pm, Frederick Cheung frederick.che...@gmail.com
wrote:
On Oct 9, 12:01 am, MaggotChild hsomob1...@yahoo.com wrote:
A Segment is linked to Media by Media.name, which is the result of
concatenating Segment.name and Segment.part. As I said there are is no
PK/PK relation so
On Oct 9, 10:24 am, Marnen Laibow-Koser rails-mailing-l...@andreas-
s.net wrote:
MaggotChild wrote:
I'm attempting to wrestle an old DB into Rails.
This relationship is giving me trouble:
class Show AR::Base
has_many :segments
end
class Segment AR::Base
belongs_to :show
I'm attempting to wrestle an old DB into Rails.
This relationship is giving me trouble:
class Show AR::Base
has_many :segments
end
class Segment AR::Base
belongs_to :show
has_one :media #this has no PK/FK relation
end
A Segment is linked to Media by Media.name, which is the result of
Several of my unit tests run queries against SphinxSE. Since Rails
creates the test DB by dumping the dev DB schema, my SphinxSE queries
aren't run against the test DB.
There seems to be no way to hook into the test:clone_structure task,
so I thought that I'll just have the appropriate unit
On Sep 24, 12:34 am, Frederick Cheung frederick.che...@gmail.com
wrote:
On Sep 23, 11:27 pm, MaggotChild hsomob1...@yahoo.com wrote:
Could someone explain this?
At a quick glance it is probably because after AttributeMethods is
included in ActiveRecord::Base, write_attribute is aliased
On Sep 24, 5:40 pm, MaggotChild hsomob1...@yahoo.com wrote:
write_attribute is at the top of the call stack so I'd think it's
going to use the most recent definition. Unless some other module
redefined write_attribute within the scope of active AR::Base (as
apposed to including it via
Could someone explain this?
#config/initializers/ar_attributes.rb
module ActiveRecord
module AttributeMethods
alias_method :ar_read_attribute, :read_attribute
def read_attribute(attr_name)
p read_override
ar_read_attribute(attr_name)
end
alias_method
Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to
I have a path that my model (Audio) uses to r/w files. This path
differs between production, test, and dev.
Audio includes a module that overrides some ActiveRecord methods.
This module is contained in config/initializers.
I'd like to set the Audio directory based on my environment, but using
Can't find the answer to this. My old message received no responses
(subject was messed up).
Is it possible to create routes that have the same URL yet map to a
different action based on the HTTP method (or pseudo method) like a
Rails' resource?
For example:
map.resources :foo, :collection = {
Is it possible to create routes that have the same URL yet map to a
different action based on the HTTP method (or pseudo method)?
For example:
map.resources :foo, :collection = { :purge = :get, :purge_them
= :post }
I'd like to use /foo/purge for both actions, and have the appropriate
I can't understand why authenticate_or_request_with_http_basic keeps
failing even though I am entering the correct info.
If I try to access /admin/items/new, I enter the correct info but I
keep getting prompted.
The strange part is that when I cancel out, I get HTTP Basic: Acce.
Here's the
I have a child relationship that is denormalized. I want to normalize
it at the object level once it's retrieved:
class Parent
has_many :denormalized_children, :class_name='Child'
def children
if @normalized_children.nil?
@normalized_children = []
I'm curious how others would deal with this situation.
In my case, I have:
class Package
has_many :deliveries
end
class Delivery
belongs_to :package
belongs_to :region
end
class Region
has_many :deliveries
end
And accept XML requests in the following manner:
package
nameGood
class House ActiveRecord::Base
belongs_to :country
belongs_to :cities
belongs_to :streets
end
Now...if i want to create a house like this:
@street = Street.find(1)
@house = @street.houses.new
@house.name = Burlington house
@house.save
Now...only the street_id key is
I'm trying to render a collection of partials using :as. It raises an
undefined local variable exception. Not sure why:
~/delivery-log/app/views/packages $ ls -1
_package.html.erb
_package_list.html.erb
index.html.erb
index.html.erb:
%=
render :partial='package_list', :collection=@packages,
On Feb 24, 11:54 am, Eric ericgh...@gmail.com wrote:
On Feb 24, 11:13 am, MaggotChild hsomob1...@yahoo.com wrote:
I'm trying to render a collection of partials using :as. It raises an
undefined local variable exception. Not sure why:
Why not use :locals = ?
Sure there a workarounds
On Feb 3, 2:18 pm, Frederick Cheung frederick.che...@gmail.com
wrote:
On Feb 3, 7:33 pm, MaggotChild hsomob1...@yahoo.com wrote:
On Feb 2, 2:54 pm, Frederick Cheung frederick.che...@gmail.com
Does it only happen when class caches is false ?
Why yes Fredrick, it does.
That pretty much
On Feb 3, 7:20 pm, Alan Brown stre...@gmail.com wrote:
So how is the conditions clause built. can you log it before passing it to
find?
Yes I can see the clause in the development log. The query is valid,
it executes fine. It's when the Delivery class is assembled by
ActiveRecord that the
On Feb 2, 2:54 pm, Frederick Cheung frederick.che...@gmail.com
wrote:
On Feb 2, 1:33 pm, Ryan Bigg radarliste...@gmail.com wrote:
Why not use a search plugin like thinking sphinx to do your searching
for you?
Overkill. The searching is rudimentary so I just quickly created
something.
This SystemStackError is driving me crazy. It only takes place when
testing with WEBrick - I can't reproduce it with any tests. It is
caused by calling the missing id method (base.rb:2435) on my
ActiveRecord class.
WEBrick and my tests are running as the same user, with a `ulimit -s`
of 10240.
On Feb 2, 1:33 pm, Ryan Bigg radarliste...@gmail.com wrote:
Why not use a search plugin like thinking sphinx to do your searching
for you?
Overkill. The searching is rudimentary so I just quickly created
something.
In any case, I take it you had no thoughts as to why I'm receiving the
stack
I don't see a way to create a single URL in a collection and then have
routing dispatch to the appropriate method based on the HTTP method.
map.resources :packages, :collection={ :search=:get }
Gets me half way there, but I can see a way to say that I want the
POST to go to the do_search
..but in general searches are GET and
never POST. I don't know where this nonsense comes from but
it's breaking the principles behind the HTTP.
Well I don't disagree with this paradigm, but the point is Rails seems
to not allow one to set up a route like the defaults provided by
I need to generate 2 types of URL and have defined my routes as:
map.country_yes
/:country/
yes, :controller=posts, :action=country, :yes=true
map.country_no
/:country/
no, :controller=posts, :action=country, :yes=false
map.yes /yes, :controller=posts, :action=index, :yes=true
map.no /no,
38 matches
Mail list logo