[Rails] Re: Simple search form with restful routes?

2009-03-07 Thread JL Smith
Yeah, I ran 'rake routes' to study the routing but I just didn't think I'd have to add to it. I specified the 'get' method to ticket_path with an ID param coming in...I don't understand why that wouldn't work. So the search method will now render the show method? or redirect_to? or what?

[Rails] Re: upgrade to Rails 2

2009-03-07 Thread Colin Law
2009/3/7 Phlip phlip2...@gmail.com I did it to several programs like this: - edit environment.rb and upgrade the version - rake rails:update - run all the tests - fix one warning or error - revert everything in config (leave the new JS) I don't understand what is meant here.

[Rails] Re: upgrade to Rails 2

2009-03-07 Thread Phlip
Colin Law wrote: Do you mean you require that the code runs on the old and new versions of rails? Is this always possible? No. When the Rails maintainers took the default paginator out, and moved it into a plugin, they very wisely (not!) decided to upgrade it at the same time. We have

[Rails] Will_paginate when used with ajax going on show method.

2009-03-07 Thread Neetal Sharma
Hi I have a problem while implementing pagination. Am using will_paginate for it. I have a index page where am dispalying a list of users with pagination. Also there is a search feature, when user searches the users list ll be changed according to the search result.Now comes the problem. This

[Rails] Storing UTC time, displaying and editing in user time zone

2009-03-07 Thread Helmut Juskewycz
Hi, I know that there are already some discussions/posts about this issue, however, none of them helped me to solve my problem. Disclaimer first: The application has done it already correctly, but now the time conversation is broken and I don't know why. I am storing a start and end time in my

[Rails] Re: upgrade to Rails 2

2009-03-07 Thread Colin Law
2009/3/7 Phlip phlip2...@gmail.com In a recent upgrade I had to change the base class for my unit tests from Test::Unit::TestCase to ActionController::TestCase which I imagine would not have worked had I reverted. Are there not other cases of code that cannot be made to work in old

[Rails] Polymorphic Nested Attributes In 2.3

2009-03-07 Thread Gary Taylor
Has anyone had any experience of using nested attributes with polymorphic associations ? I cannot see how it would work as the model would need to know the class of the object to create (when creating a new record for the association). Here is an example class MyClass ActiveRecord::Base

[Rails] Turn off profiling in tests

2009-03-07 Thread Tobi
Hi all, Is there a way to turn off profiling output when running app tests? It can be done by rake test 2/dev/null because profiling output is written to STDERR, but I want it off per default. Thanks Tobi --~--~-~--~~~---~--~~ You received this message because

[Rails] Playing videos

2009-03-07 Thread Martin Hawkins
I'm working on a project that involves the playing of .avi files from a huge source library. Meta data about the files is stored in a database and the files are stored elsewhere in a file structure that is easy to access. I'm new to video playback and what I have tried so far is unsatisfactory.

[Rails] counter cache problem

2009-03-07 Thread pankaj
Here is the problem There is a gallery model and image model gallery has many images gallery has images_count. When I change image from one gallery to another i have to update the counter cache(It does not happen automatically on doing gallery2.images image). So i do gallery1.images_count -= 1

[Rails] Re: counter cache problem

2009-03-07 Thread CFC
Gallery.rb has_many :images, :counter_cache = true On Sat, Mar 7, 2009 at 8:23 PM, pankaj pankajbhage...@gmail.com wrote: Here is the problem There is a gallery model and image model gallery has many images gallery has images_count. When I change image from one gallery to another i have

[Rails] Parsing html files = putting them in fixtures for testing

2009-03-07 Thread Constantin Gavrilescu
I'm using Hpricot parser to scrape web pages. I saved two of these pages for a test in lack of a better way, I put the html files in the fixtures like this: dl_found_tickets: html: %= File.read( 'test/fixtures/html/ search_dl_found_tickets.html' ).gsub('', '\') % [...] Even though the

[Rails] Re: setting header in views?

2009-03-07 Thread engineerDave
stubmbled across this message right after looking at this message. http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/fea26c9c3c01ba93?pli=1 Maybe it will help you. Good Luck! On Jan 13, 10:50 pm, Lin Wj rails-mailing-l...@andreas-s.net wrote: currently iam using FasterCSV

[Rails] Ozéias Sant'ana for hire

2009-03-07 Thread Ozéias Sant'ana
If you’re looking to hire someone with strong Ruby/Rails skills, give Ozéias a look. http://railsbox.org/2009/3/4/ozeias-sant-ana-for-hire I can be contacted at oz.sant...@gmail.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[Rails] Re: How would I extract data from this hash?

2009-03-07 Thread Frederick Cheung
On Mar 7, 7:50 am, Phlip phlip2...@gmail.com wrote: And is there a way to use :group to get it down to just one (1) query?? Team.count :all, :group = 'DATE(created_at)' Fred --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[Rails] Re: Parsing html files = putting them in fixtures for testing

2009-03-07 Thread MaD
you are right. it seems like an error that occurrs after reading your yml-file. obviously there are some additional whitespaces/carriage returns added to it. but you could just gsub them. but other than that, one question: why do you want to save a html string in a yml-file (and not just read

[Rails] Re: upgrade to Rails 2

2009-03-07 Thread Phlip
Colin Law wrote: An alternative strategy that has worked for us is to do the mods for the Rails upgrade on a branch. Merging in changes from the current master/trunk is then the equivalent of your integrate phase as it picks up mods done by other team members on the master. Only rarely

[Rails] Disqus Gem; creating new threads

2009-03-07 Thread Ramon Tayag
Hey everyone, I need a bit of help with the Disqus gem. I can't seem to create new threads. Just to test it out, I tried to create a thread in the console: Disqus::Api.thread_by_identifier(:forum_api_key = the api key of the forum i want to post this comment in, :identifier = some nutty

[Rails] Re: How to access the binding of the caller within a method

2009-03-07 Thread 郝伯乐
Clive, It seems to me that you could just pass binding to the properties method you define. For example: require 'erb' def properties(text_key, b) return ERB.new(%= boy % kissed %= girl %).result(b) end boy = Tom girl = Jenny puts properties(something, binding) The above outputs the

[Rails] Re: Disqus Gem; creating new threads

2009-03-07 Thread Ramon Tayag
Okay I did more playing around, got the curl to work by wrapping the URL with quotes :s Now I know the API works (yes, I got to that point), I still need to figure out why I can't do it in the console... unless I really am not supposed to be able to do it on the console. Ramon Tayag On Sat,

[Rails] Different database for different domains

2009-03-07 Thread Konstantin
Hello! 1. I have 2 domains site1.com and site2.com. The same application is installed on both, but I need it to use different database: db1 for site1.com and db2 for site2.com How can I do this? 2. And another question about subdomains. Usually I use something like that: link_to 'Link title',

[Rails] Plugin Announce: active_record_random_find (finding random models with ActiveRecord)

2009-03-07 Thread Steven Hilton
Need to get a random record from the database using Active Record? Use the spiffy new plugin Active Record Random Find, which uses no vendor-specific database function calls. http://github.com/mshiltonj/active_record_random_find/tree/master I wrote a little bit about it here:

[Rails] Re: counter cache problem

2009-03-07 Thread pankaj
I have already added :counter_cache with the belongs to relationship, it cannot be added with has_many. Any ways I am updating the counter manually, and it is not happening. Regards, Pankaj On Mar 7, 5:30 pm, CFC zuso...@gmail.com wrote: Gallery.rb has_many :images, :counter_cache = true

[Rails] Re: ActionController : Exception caught

2009-03-07 Thread Intern ruby
Thanks Bill for your reply. Yes, I am new to ROR. Please tell me where am I wrong. I have attached code. Thanks, Yati Attachments: http://www.ruby-forum.com/attachment/3405/testday2.zip -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You

[Rails] how to retrieve single record through chained associations

2009-03-07 Thread Tod Tod
Hi I have a standard associations belongs_to, has_many :through class Shop ActiveRecord::Base has_many :show_categories has_many :categories, :through = :shop_categories end class Category ActiveRecord::Base has_many :shop_categories has_many :shops, :through = :shop_categories end

[Rails] Re: Parsing html files = putting them in fixtures for testing

2009-03-07 Thread Constantin Gavrilescu
On 7 mar, 07:39, MaD mayer.domi...@gmail.com wrote: you are right. it seems like an error that occurrs after reading your yml-file. obviously there are some additional whitespaces/carriage returns added to it. but you could just gsub them. It may not be just the whitespace, because the parser

[Rails] Re: OpenFlash Chart not able to load the flash

2009-03-07 Thread rainer54
Had a similar issue, solution was to place the call for the chart into the view: %= javascript_include_tag swfobject.js % % chart_action = /flash_charts/#...@offer.id}/price_quantity_chart % % @graph = open_flash_chart_object(500,400, chart_action, true) % %= @graph % cheers, rainer Sahil

[Rails] Re: how to retrieve single record through chained associations

2009-03-07 Thread rainer54
Hi Tod For finding the category 10 of shop 1, the following should work by using Activerecord associations Shop.find(1).categories.find(10) or Shop.find(1).categories.find(:first, :conditions = 'category = 10') rainer Dharmdip Rathod wrote: Hi I have a standard associations

[Rails] i cannt able to save the data.???

2009-03-07 Thread haneef5k
h2bActiveRecord::StatementInvalid in PublicController#create /b/ h2 Mysql::Error: Unknown column 'albums.artist' in 'where clause': SELECT * FROM `albums` WHERE (albums.artist IS NULL) LIMIT 1 --~--~-~--~~~---~--~~ You received this message because you are

[Rails] Re: i cannt able to save the data.???

2009-03-07 Thread Frederick Cheung
On Mar 7, 5:57 pm, haneef5k hanee...@gmail.com wrote: h2bActiveRecord::StatementInvalid in PublicController#create /b/ h2 Mysql::Error: Unknown column 'albums.artist' in 'where clause': SELECT * FROM `albums`   WHERE (albums.artist IS NULL)  LIMIT 1 Hard to say without more information

[Rails] Re: how to retrieve single record through chained associations

2009-03-07 Thread Tod Tod
Hi rainer54 Actually Shop.find(1).categories.find(10) and Shop.find(1).categories.find(:first, :conditions = 'category_id = 10') are the different ways to retrieve same category record in association with shop 1. But going further with association I need to retrieve records from

[Rails] Re: i cannt able to save the data.???

2009-03-07 Thread haneef5k
Thank for ur reply!! im new to ruby on rails,,im learning by video tutorial. wat im try to say is if i save the data by album its not redirecting to the page..?? On Mar 7, 10:59 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Mar 7, 5:57 pm, haneef5k hanee...@gmail.com wrote:

[Rails] Re: how to retrieve single record through chained associations

2009-03-07 Thread Tod Tod
Hi Frederick Thanks for answer. I'm just trying to investigate why it is not chained whole over all associations. I think that each association shuold act as maybe proxy and pass from begining Shop.find(1) till the end of this chainings and pass Shop record. It sounds to me naturally way of

[Rails] Re: i cannt able to save the data.???

2009-03-07 Thread haneef5k
can u tell me as details..?? abt migration...?? and actully im doing online music_library... On Mar 7, 11:06 pm, haneef5k hanee...@gmail.com wrote: Thank for ur reply!! im new to ruby on rails,,im learning by video tutorial. wat im try to say is if i save the data by album its not

[Rails] Re: how to retrieve single record through chained associations

2009-03-07 Thread haneef5k
can u tell me online tutorial..??? On Mar 7, 10:55 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Mar 7, 4:39 pm, Tod Tod rails-mailing-l...@andreas-s.net wrote: Logically this kind of chaining Shop.find(2).category.find(10).shop_categories should collect and join

[Rails] Re: how to retrieve single record through chained associations

2009-03-07 Thread Frederick Cheung
On Mar 7, 6:08 pm, Tod Tod rails-mailing-l...@andreas-s.net wrote: I'm just trying to investigate why it is not chained whole over all associations. I think that each association shuold act as maybe proxy and pass from begining Shop.find(1) till the end of this chainings and pass Shop

[Rails] Re: i cannt able to save the data.???

2009-03-07 Thread Frederick Cheung
On 7 Mar 2009, at 18:10, haneef5k wrote: can u tell me as details..?? abt migration...?? and actully im doing online music_library... Not really. All I can tell from what you've said is that you're trying to do something with a column that doesn't exist (and there not much that can be

[Rails] Re: how to retrieve single record through chained associations

2009-03-07 Thread rainier
ok - misunderstood this The solution is already given by Fred On 7 Mrz., 19:01, Tod Tod rails-mailing-l...@andreas-s.net wrote: Hi rainer54 Actually Shop.find(1).categories.find(10) and Shop.find(1).categories.find(:first, :conditions = 'category_id = 10') are the different ways to

[Rails] Re: i cannt able to save the data.???

2009-03-07 Thread haneef5k
Now i do some changes in my music_library now its so., NoMethodError in PublicController#update undefined method `artist' for #Album:0x2c1db60 On Mar 7, 11:24 pm, Frederick Cheung frederick.che...@gmail.com wrote: On 7 Mar 2009, at 18:10, haneef5k wrote: can u tell me as details..?? abt

[Rails] Sending multiple checkboxes values clicking a link

2009-03-07 Thread Juan Kinunt
Hi, I have multiple checkboxes in a table each one representing an item. They are like this: [...] td%= check_box incidencias_ids, incidencia.id %/td td%=h incidencia.cliente.nombre %/td [...] In the controller I have: incidencias_ids = params[:incidencias_ids] @incidencias = []

[Rails] Re: Sending multiple checkboxes values clicking a link

2009-03-07 Thread Frederick Cheung
On 7 Mar 2009, at 18:45, Juan Kinunt wrote: Hi, I have multiple checkboxes in a table each one representing an item. They are like this: [...] td%= check_box incidencias_ids, incidencia.id %/td td%=h incidencia.cliente.nombre %/td [...] Try check_box_tag incidencias_ids[],

[Rails] Re: Gem update problem

2009-03-07 Thread Scott Tadman
Jose vicente Ribera pellicer wrote: Jose vicente Ribera pellicer wrote: solved with gem install ar_mailer Ummm, not solvd at all. Now I can use my localhost but when I try to update my gems I see the same error. :( I can work fine, but i don't like to see this kinds of errors when i

[Rails] RJS: pass javascript variables in ruby calls

2009-03-07 Thread RoR_lion
Hey, I have this link_to_function which takes an RJS block as follows: page.insert_html :bottom, :documents, :partial = upload_fields, :locals = { :doc = Document.new, :index = 'UNIQUE_ID' } It adds a partial to a div. I need index to be a unique id, but can't generate one. I have an

[Rails] Be careful of BIGINT primary key fields in MySQL. Will cause problems with ActiveRecord create (but not find)

2009-03-07 Thread chrisf
The MySQL/Ruby library doesn't properly handle inserts into tables with the primary key being a BIGINT If the ID returned to the MySQL/Ruby library is LARGER than the INT range, the value is returned to Ruby truncated and incorrect. This is then passed up to ActiveRecord and into the id field of

[Rails] Re: How would I extract data from this hash?

2009-03-07 Thread Rob Biedenharn
On Mar 7, 2009, at 2:50 AM, Phlip wrote: [1.day.ago, 2.days.ago].inject({}) do |hash, days| hash[days] = Team.count(:conditions = (days .. days + 1.day)) hash end Thanks Phlip! Really appreciate your generous help. I just discovered the inject method, and you pointed me in the

[Rails] Where to put my JS stuff?

2009-03-07 Thread Mathieu Rousseau
Hello, I'd link to know your opinion about where should I put some JS logic, In a form i put it all in the submit button, and in another I put it in the controller. See: *First way:* Form: %= submit_to_remote 'Save', 'Save', :url = {:action = 'update', :id = @folder}, :update =

[Rails] [JOBS] Ozéias Sant'ana for hire

2009-03-07 Thread Ozéias Sant'ana
If you’re looking to hire someone with strong Rails skills, give Ozéias a look. http://railsbox.org/2009/3/4/ozeias-sant-ana-for-hire I can be contacted at oz.sant...@gmail.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[Rails] MIgration Problem in 2.1.2

2009-03-07 Thread Colin Summers
I suspect this is because it is a 1.x application which was upgraded, but my migrations don't stick. If I Coder-iMac:patton colin$ rake db:migrate (in /Users/colin/Desktop/patton) == 20090217193953 AddLastYearToTarget: migrating == == 20090217193953

[Rails] Re: Storing UTC time, displaying and editing in user time zone

2009-03-07 Thread Rick
This might help: http://www.marklunds.com/articles/one/402 On Mar 6, 11:56 pm, Helmut Juskewycz hjuskew...@gmail.com wrote: Hi, I know that there are already some discussions/posts about this issue, however, none of them helped me to solve my problem. Disclaimer first: The application has

[Rails] [ANN] ActiveRecord .from_xml upgrade

2009-03-07 Thread Phlip
Rubies: The gist of this tiny code snip... http://gist.github.com/75525 ...is a light but flexible DSL that converts XML - typically output by to_xml() - into an ActiveRecord object model. ==create or update records== Here's the simplest example: xml ='photos photo

[Rails] RESTful nested resources and polymorphism?

2009-03-07 Thread Carlos Santana
With ref to my previous post: http://www.ruby-forum.com/topic/180356 I am now able to access items from topics controller. However, now I need to add sub-item e.g.: An item itself could have many sub-items. So my items model is like: class Item ActiveRecord::Base validates_uniqueness_of

[Rails] about cache and will_paginate

2009-03-07 Thread Rustam Mamat
Hi all , recently i have create a project with rails 2.1 and it works very well include will_paginate ,once i have add action_cache to the activecontroller ,the will_paginate was out of function , i don`t know why ,can anyone help ? -- Posted via http://www.ruby-forum.com/.

[Rails] RESTful nested resources and sele referential

2009-03-07 Thread Carlos Santana
I think I mean to say self-referential rather than polymorphism.. Sorry.. CS. Carlos Santana wrote: With ref to my previous post: http://www.ruby-forum.com/topic/180356 I am now able to access items from topics controller. However, now I need to add sub-item e.g.: An item itself could have

[Rails] Set Default Radio Button Value (html)

2009-03-07 Thread David
Is there a way to set the default value of a radio button that is coded in html with the value from an object? I am trying to set up an edit view for this object and am using submit_to_remote, so I cannot use the rails radio button helper. These are my radio buttons: input

[Rails] Re: routes.rb problem

2009-03-07 Thread Sarah Allen
Salil Gaikwad wrote: i try something like this in routes.rb map.connect 'issues/:action', :controller = 'issues', :action='new' and then restart the server but it doesn't works Try this in irb rts = ActionController::Routing::Routes rts.recognize_path(issues/new) and it'll return

[Rails] Logging question

2009-03-07 Thread Errol Siegel
I have been using the Slantwise Fetcher plugin for a while now. I have run into some problems lately and it's a bit of a pain to troubleshoot because it is not clear where (or if) it logs anything. Can anybody give me some pointers about how to enable logging for this? It would be great if I

[Rails] Re: About before_* callbacks

2009-03-07 Thread CFC
Okay, I seeThanks, Matt. On Fri, Mar 6, 2009 at 12:31 AM, Matt Jones al2o...@gmail.com wrote: On Mar 4, 11:13 pm, CFC zuso...@gmail.com wrote: Hi I have an problem about before_* callbacks. I have a model named: Event And I don't want anyone to destroy or update any records in

[Rails] Re: ActionController : Exception caught

2009-03-07 Thread bill walton
On Sat, 2009-03-07 at 17:32 +0100, Intern ruby wrote: Thanks Bill for your reply. Yes, I am new to ROR. Please tell me where am I wrong. I have attached code. It's more typical to simply copy the relevant pieces of code than to zip an entire project. However, the error message you cited in

[Rails] permalink_fu step by step help

2009-03-07 Thread Rails List
Guys Has anyone used permalink_fu before?. Could someone throw a brief step by step how to use. whatever I have found on the internet does not seem to work. thanks -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message

[Rails] 2 Issues - On load component hiding ; Separate find methods

2009-03-07 Thread vishy
I have been working on developing a blog site using rails. This is my first rails application, hence I am fairly new to rails development. Over the past week, I have encountered a few issues and hence I am putting them all in one post here. Please feel free to comment on any of the below

[Rails] Displaying content using rails

2009-03-07 Thread vishy
All, I am trying to implement some ajax functionality on my web site. I have a list of links and each link have many items associated with it. For example, My Netflix queue link is connected to 10 movies (items). Now, I am trying to display a table with these items when the user clicks on the

[Rails] Re: Different database for different domains

2009-03-07 Thread Konstantin
2. And another question about subdomains. Usually I use something like that: link_to 'Link title', :sort = 'soft_field' - and this produces a link to the current url with additonal ?sort=sort_field parameter:http://site1.com/controller/?sort=-sort_field But this doesn't work on subdomains