Displaying 20 results from an estimated 10000 matches similar to: "How to save parent and child objects in a single action?"
2006 Mar 08
19
Creating multiple rows with one form
Hello. I''ve been trying this out for the past two days and I can''t seem to
get it. I''m going to have a page where you can upload x amount of images at
once. Lets say 10 images need to be uploaded, all with a caption.
I''d like to have a browse button to choose the file, then the caption. Now,
if I put 10 of them in one form, fill them all out and submit, I get
2006 Mar 09
7
How to restrict access to admin part of the page?
Hi!
What is the easiest way to restrict access to some part of the page?
In php i just put .htaccess and .htpasswd files in /admin folder and it
worked.
Now i''ve got one admin folder for controllers, one for views, public
folder and i''m not really sure if it''s still possible. So what is the
easiest way? I don''t have any user logging features on my site,
2006 Mar 08
3
attribute or instance method or what?
Hi!
Uhm are attributes just something like additional members of a class,
other than those that come from the names of columns in the table?
I''ve got images table, which has ''name'' column. I''ve added support for
creating thumbnails out of uploaded pictures and i''d like to have an
easy way of accessing them in my views.
How to do it? I.e. my image
2006 Mar 13
6
Specifying none/single/many conditions at the same time
Hi!
It''s rather ruby question than rails...
I have a single ''list'' action where i call paginate method.
I can receive none, 1 or 2 variables that specify conditions for
paginate method.
How to write the code so i can call paginate without conditions if all
conditions variable are nil, with a single condition if one of
conditions variables is not empty and with 2 if
2006 Mar 08
3
Many renders in one view?
Hi!
This was probably asked many times, but i can''t find it anywhere.
How to render in my view many actions (sometimes from different
controllers)?
So i.e. I will have user status/login form at the top, form for
creating/editing some data on the left and a list of these data elements
on the right and some other things at the bottom?
Can i put some of this stuff to the layout? So i
2006 Mar 14
3
How to write ! version of non ! method?
Hi!
How to write i.e. array.join! based on array.join method?
--
Posted via http://www.ruby-forum.com/.
2006 Mar 22
4
How to write this SQL query?
Hi!
Is there rails version of "where column in (value1, value2, ...)"?
I know i could do OR many times, but this way is shorter.
I''m ruby/rails newbie, so i have a problem with converting the hash,
which i''m receving from the search form into the string for :conditions
in find method.
Could i instead of creating one, complicated (for me) query do something
like
2006 Mar 06
5
Question about file_column plugin
Hi!
File_column plugin saves uploaded files to
"public/model/image/model_id/filename", if i understand it correctly.
Does it mean that it creates new folder for every image?
I have product (model) that has_many images (model). Is it possible to
use (or modify) this plugin that it would save my images to different
folder, so the id of the model_id part would be id of the product
2006 Mar 05
4
Resizing images and creating thumbnails
Hi,
1. How to resize an image uploaded by a web form before saving it to the
disk? (i need all uploaded images to have similar size)
2. How to create thumbnails? Is it enough if i specify small size of the
image in html or would the image look horrible? Can i do it somehow in
''realtime'' using javascript? Or is it best to create thumbnail as a
separate file?
3. How to get
2006 Apr 21
1
Which internationalization plugin to choose?
Hi,
I need to create rather simple page (gallery + news), but it has to be
in 3 different languages (polish, english, german). Which plugin do you
recommend? How to store translated data in the database - in a single
table with separate field for every language or in separate table for
every language?
--
Posted via http://www.ruby-forum.com/.
2006 Mar 09
2
How to keep formatting of text in textarea?
Hi!
I''ve got a form for creating news and i''d like to keep formatting of the
text in the textarea - if user presses enter twice, or presses space ten
times it should be visible when editing or showing the news.
Probably i should add before_save filter and some regexps for adding
html tags, but i know almost nothing about regexp. Maybe there''s a
simpler way also.
2006 Mar 23
3
How to redisplay submitted data on validation error?
Hi!
If i have an object it''s easy.
But i''m making a simple contact form and i check if email address is
correct. If it''s not i redisplay the form with the info that there was
an error (should i use redirect_to or render :action? what''s the
difference?), but all previously submitted data is lost.
I tried creating variables using names of the form fields, but
2006 May 03
1
Globalize app example anywhere?
Hi!
Is there anywhere tutorial how to create working application using
globalize plugin?
I need to create a site in 3 different languages and i was suggested to
use globalize plugin. I''ve read a bit on globalize wiki page and pdf
from the presentation available on the same page, but i still can''t
figure out how to use it.
1. Can i translate names of models and columns
2006 Mar 17
6
Problem with ruby 1.8.4 One-Click Ruby Installer on windows
Hi!
Previously i had ruby 1.8.2 (One-Click Ruby Installer) installed, but
the rdoc and plugindoc didn''t work, so i decided to install ruby 1.8.4.
I had uninstalled ruby 1.8.2 (uninstaller deleted the whole ruby folder
with radrails and everything, just great) and installed One-Click Ruby
Installer 1.8.4-16 preview3.
Then installed rails, rmagick, radrails, created docs for trunk
2006 May 25
7
Grouping controllers
I''m grouping controllers to avoid cluttering the top-level namespace.
First, I used script/generate Admin::Customers new edit show list and then I
used
script/generate Admin::Providers new edit show list.
The generator created the subfolders correctly: I have an admin folder and
inside there''s customer_controller.rb and provider_controller.rb.
I have the same structure in
2006 Mar 20
3
Where does it come from?
Below every page in the browser i get:
"Loaded suite dispatch.cgi Started Finished in 0.000225 seconds. 0
tests, 0 assertions, 0 failures, 0 errors"
I''m not sure if i changed something or someone else did it, but now i
don''t know how to get rid of it. It has something to do with testing,
right? How to switch it off?
--
Posted via http://www.ruby-forum.com/.
2006 May 26
0
how to prevent child.save() when doing parent.save() in associations?
When using has_one or has_many associations, how do I prevent a call
to the parent''s save() method from calling the child''s save() method?
I seem to be stuck in an infinite loop due to the way I have my
associations setup :-(
thanks,
Tim
2013 Feb 06
0
inverse_of breaks for unsaved child associations during save of parent
I''m willing to write a patch for this issue:
https://github.com/rails/rails/issues/8893
But want to confirm that the new behavior makes sense before I make the
effort.
Essentially if you have an unsaved parent and child, and the parent''s
association to the child has an inverse_of declared on it. When the parent
gets saved, it updates the foreign key on the child, and this
2006 Apr 22
0
Re: Rails Digest, Vol 19, Issue 611
Thanks szymek for putting me on track. What I did was re-intstall the
file_column plug-in but I still got the same error so I added @recipe =
recipe and then then error changed to something about nil.first. So I added
a
rescue "no image"
to the end of my image_tag like so
<%= image_tag url_for_file_column("recipe", "image") rescue "none" %>
and
2006 May 12
5
Implementing URLs with more than 3 levels in Rails.
Hi There
I started using Rails recently, and I see it''s very easy for URLs that
have up to 3 levels:
/:controller/:action/:id
But what do you do when you need more than 3?
For example, my current project should have an "admin" interface.
Admin has several sub-interfaces, for example a "users" interface. And
the admin/users interface has several actions, e.g.