similar to: Newbie problem with adding new method to a class

Displaying 20 results from an estimated 12000 matches similar to: "Newbie problem with adding new method to a class"

2006 Jul 17
6
3 newbie questions
hey all, I have 3 tables like this: Images (id,name) Tags (id,name) ImagesTags(imageid,tagid) in my image model I do a "has_and_belongs_to_many :tags" but to make it work I need to rename ImagesTags(imageid,tagid) to Images_Tags(image_id,tag_id). My question is that given that I can''t rename the table, is there any way to make it work with the original names? Second question:
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 14
5
How to display different images using ajax?
Hi! On my page i display one full size image and a list of thumbnails. I''d like to change the full size image with a full size version of a thumbnail, after clicking on one of them. How to write controller action, so it would update the image without reloading the whole page? It''s easy with text, but how to reload an image? -- Posted via http://www.ruby-forum.com/.
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
2010 Oct 01
20
Paperclip not executing FFMPEG properly
Im using a customs processor to run ffmpeg on a video to create a thumbnail. So far so good. Except when I do: cmd = "-i #{@file.path} -f flv -s 320x240 ~/Downloads/foobar/q.flv" success = Paperclip.run(''ffmpeg'', cmd) Console is reporting: ffmpeg ''-i /var/folders/uL/uL0bYOOZEZaJH5E+BmDJVE+++TI/-Tmp-/stream, 16824,1.mpeg -f flv -s 320x240
2006 Apr 24
0
ImageMagick and EXIF Data
Hi there, I''m writing a little application that parses an image file and extracts the camera settings from the file (the EXIF data) and saves all the fields to the database. The idea is that after awhile people will be able to search based on camera make, model, lens settings, etc... and all the pictures that meet those requirements will be displayed. The picture is stored on the file
2006 Jul 25
1
How do I validate using associated objects?
This doesn''t make any sense to me anymore. I have an Upload that belongs_to a Comment. Within my Upload model I expect to be able to access the associated comment with comment.foo. I can only seem to do this AFTER validation. I''m assuming before_create takes place between validation and updating the database, because when I try to access comment.foo within the validate
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,
2009 Dec 22
3
vector indexing problem in multilevel data: assigning a specific value to all group members
Dear List, I work with multilevel data from psychological group experiments and have frequently encountered a situation for which I haven't found an elegant solution: I need to assign the value of a specific group member to all members of the group. For example, I have a group leader (identified by a binary vector) and some attribute for all group members. I want to create a new
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 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 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 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 14
3
How to save parent and child objects in a single action?
Hi! I''m struggling with it for a week. I posted a few similar posts that cleared up few things (thanks Mark!), but i still don''t know how to do it properly. What i''m trying to do is to create parent object and its many children (images - i tried using file_column, but it''s a topic for another post)using data from a single form. I''ve got a working
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 Feb 25
2
newbie advice
Hello Everyone - Newbie here. My programming experience is primarily SQL, SAS (if anyone knows that), and a little tiny bit of ASP. Want to get going on Rails. Any suggestions? Was thinking of "4 Days on Rails". Thoughts? Thanks - Brian
2006 Jan 13
2
newbie: access model inside a model
Hi everybody, I''ve started to learn Ruby on Rails with the two books, of course I''m experimenting outside the examples in the book and walking against some things I didn''t learn yet. so here''s the question: Is it possible to access one model from within another? Actually I have a Many to Many relationship between tables and I''m trying to realize
2006 May 25
2
Newbie AJAX rjs syntax question
I''m brand new to Ruby and to Rails, and I''m running through Pragmatic''s "Agile Development" V.2 book and am having problems with the rjs files in their tutorial. First problem: page[:cart].replace_html :partial => ''cart'', :object => @cart This line stopped the AJAX request. The action completed without trouble, but when it hit
2006 Jan 10
5
No layout for specific method
Is there a way to not specify a layout for a particular method in a controller? In this particular instance, I am using the admin layout for the login controller, but I don''t want the layout to be used on the "login" method. Thanks, Dan
2011 Nov 21
1
Weird R's behaviour with a quoted name
Can someone explain why the following happens? --- :> quote(some.name) some.name :> bar <- structure(quote(some.name), class = "foo") :> quote(some.name) Error in print(some.name) : object 'some.name' not found :> bar <- quote(some.name) :> quote(some.name) Error in print(some.name) : object 'some.name' not found :> bar <-