Re: [Rails] Image preloading

2010-04-11 Thread steve ross
It all depends, as you say, on why you're preloading the images. Most of the image preloading code looks exactly like the OP's and works fine if your UI relies on just having the images cached by the browser so they can work in smooth rollovers or other page effects that rely on image swapping.

[Rails] Re: Custom Routes

2010-04-11 Thread Priyanka Pathak
Hi, As you want country name instead of id than pass name field. and in show method you have to search according to country name instead of id. As you required admin as prefix. so create namespace and define routes as map.namespace :admin do |admin| admin.resources :countries

[Rails] Re: Re: ajax in layout?

2010-04-11 Thread Veena Jose
Thanks Bala.. periodically call remote worked for me Thank You very much, Veena -- Posted via http://www.ruby-forum.com/. -- 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-t...@google

[Rails] Re: How to copy a selected value into a text_field

2010-04-11 Thread Priyanka Pathak
RichardOnRails wrote: > In app\views\expenses\new.html.erb, I (mistakenly) replaced the > script/generated: > <%= f.label :vendor %> > <%= f.text_field :vendor %> > with: > <%= f.label :vendor %> > <% @current_vendors = Vendor.find(:all, :order=>"nickname") %> > <%= select_tag "list", options_for

[Rails] Re: Re: rake db:create uninitialized constant Mysql::Error

2010-04-11 Thread Michael Michael
John Grimes wrote: > Post up the output of this command: > gem list *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.0.beta2, 2.3.5, 2.2.2, 1.3.6) actionpack (3.0.0.beta2, 2.3.5, 2.2.2, 1.13.6) actionwebservice (1.2.6) activemodel (3.0.0.beta2) activerecord (3.0.0.beta2, 2.3.5, 2.2.2, 1.15.

[Rails] Re: Re: rake db:create uninitialized constant Mysql::Error

2010-04-11 Thread Michael Michael
Yes I did, I kind of gave up for now on this. I can't seem to figure it out. If you could or anyone could help me out would be great. Thanks again for the response. Conrad Taylor wrote: > On Sun, Apr 11, 2010 at 5:28 PM, Michael Michael > wrote: > >> my gem file already has it, any other solu

[Rails] Customized Route Resource Helper URLs (to not use 'id')

2010-04-11 Thread Seth Willits
Say I have a "Member" ActiveRecord object with a typical integer id attribute, and a string 'username' attribute. If I generate routes for members using map.resources :members, then the output from the edit helper is: edit_member_path(@member) => "members/23/edit" My goal is that I really want:

[Rails] Re: display USERNAME next to post

2010-04-11 Thread Priyanka Pathak
Hi, As you want to display owner of post next to the post. Use post.user.name to display owner of the post. I think there is one to many relation exist between user & post model. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Goog

[Rails] Re: Image retrieve

2010-04-11 Thread Priya Buvan
Thanks Anthony.. But i have changed my logic to display the image.. Now i'm saving the uploaded images in application's public folder itself.. Anyway thank you very much for your reply.. That article is really useful and helpful.. -- Posted via http://www.ruby-forum.com/. -- You received this m

Re: [Rails] Re: ajax in layout?

2010-04-11 Thread Bala
Veena, try periodically call remote instead of observer field. Thanks, Bala On Mon, Apr 12, 2010 at 9:59 AM, Veena Jose wrote: > Hai Anthony, > I didn't get the ajax part working.Ths is my code.Can you plz help > me > > layout (home.html.erb) > .. > <%= @time %> > <%= o

[Rails] Re: ajax in layout?

2010-04-11 Thread Veena Jose
Hai Anthony, I didn't get the ajax part working.Ths is my code.Can you plz help me layout (home.html.erb) .. <%= @time %> <%= observe_field :time_div, :url => {:controller=>"home",:action => :show_time },:frequency => 0.25, :update => :time_div %> Controller .. c

[Rails] getting a duplicate record with has_many and update_attributes

2010-04-11 Thread Bob Smith
Please help. I've tried all i know with no results... I have an app with a master class using has_many to another class. When I create a new record with the params showing all fields for master and the has_many class it seems to work OK. But doing an edit on the record shows two copies of the has_

[Rails] Clearing a plugins instance variables on each request

2010-04-11 Thread SeanWalberg
I'm trying to move some of my application's code into a plugin, specifically the part that deals with web analytics. Some of the features allow the controller to fire events that get displayed in the views as JS code through a partial or helper. I'm currently doing this with instance variables, but

[Rails] Re: has one relationship through join table - orphaned records on update

2010-04-11 Thread dbkbali
Interestingly when editing the records individually no orphaned records are created. This would appear to have something to do with the Params hash being returned to the server and the nested fields for. The params hash being returned for a bulk update is detailed below: Parameters: {"listing_i

[Rails] Re: dynamically linking to ajax.googleapis jquery

2010-04-11 Thread Tom Mac
Hi Joe Thanks for your elaborate answer. It was useful Tom -- Posted via http://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscr

Re: [Rails] Re: Don't Automatically start SESSION?

2010-04-11 Thread Anthony Crumley
David, If you still need some help with this then please provide the user controller code. Anthony Crumley http://commonthread.com On Sat, Apr 10, 2010 at 12:42 PM, David Zhu wrote: > i really need help. anyone got a solution? > > On Apr 10, 8:51 am, David Zhu wrote: > > how do i disable it? >

Re: [Rails] Re: test database and migrations

2010-04-11 Thread Anthony Crumley
You might be interested in the Faker gem that will create data for you in all kinds of formats. On Sun, Apr 11, 2010 at 4:55 PM, Grary wrote: > Thanks guys. > > What's strange to me is the idea that Rails testing is not > comprehensive, i.e., there are constants, e.g., zip codes, that you > will

[Rails] Re: Reloading controller plugins on each request

2010-04-11 Thread Nick
On Apr 11, 6:26 pm, Frederick Cheung wrote: > If you want something to be reloadable you should use > require_dependency to load it. The main thing though is that a > plugin's init.rb is not re-run between requests, so the include you do > on ApplicationController is lost after the first request.

Re: [Rails] Re: rake db:create uninitialized constant Mysql::Error

2010-04-11 Thread Conrad Taylor
On Sun, Apr 11, 2010 at 5:28 PM, Michael Michael wrote: > my gem file already has it, any other solutions? I just decided to do > the package install of mysql to see if i was manually installing it > wrong, and nope same issue still. > > Michael, did you run the following in the root of your Rails

Re: [Rails] Re: rake db:create uninitialized constant Mysql::Error

2010-04-11 Thread John Grimes
Post up the output of this command: gem list On 12 April 2010 10:28, Michael Michael wrote: > my gem file already has it, any other solutions? I just decided to do > the package install of mysql to see if i was manually installing it > wrong, and nope same issue still. > > > > > > source 'http://

[Rails] Nested forms: Can you access the object from within fields_for?

2010-04-11 Thread John Grimes
Hi all, Say I had the following form: <% form_for @user do |f| %> <%= f.error_messages %> <% f.fields_for :friends do |friends| %> <%= friends.text_field :relationship_to_you %> <% end %> <%= f.submit "Submit" %> <% end %> Is it possible to access the current object within that field

[Rails] has one relationship through join table - orphaned records on update

2010-04-11 Thread dbkbali
I have set up the following relationships Rails 2.3.5 and on update I am finding that orphaned records are generated. Are my relationships wrong or is there a recommended way to manage these orphaned records on an update. Code is detailed below: class User has_many :management_assignments, :forei

[Rails] minify html views layouts

2010-04-11 Thread Xia __
Hello, Does anyone have any tips for minifying views and layouts? IE removing whitespace Thanks ahead -- Posted via http://www.ruby-forum.com/. -- 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 rubyo

[Rails] display USERNAME next to post

2010-04-11 Thread David Zhu
Hello, I'm sure all of you have done this before, basically users can post new posts, but i want their names next to the post. I have a current_user helper method, but i dont know how to display a static one next to that one post. Anyhelp would be appreciated :) thanks -- You received this me

[Rails] Re: rake db:create uninitialized constant Mysql::Error

2010-04-11 Thread Michael Michael
my gem file already has it, any other solutions? I just decided to do the package install of mysql to see if i was manually installing it wrong, and nope same issue still. source 'http://rubygems.org' gem 'rails', '3.0.0.beta2' # Bundle edge Rails instead: # gem 'rails', :git => 'git://git

Re: [Rails] rake db:create uninitialized constant Mysql::Error

2010-04-11 Thread Conrad Taylor
On Sun, Apr 11, 2010 at 4:19 PM, Michael Michael wrote: > I have yet to find a solution for this issue I have tried multiple > things that I have found on google, but yet have i found a solution. If > someone could help me and point me in the right direction I would be > much appreciated. > > Than

[Rails] rake db:create uninitialized constant Mysql::Error

2010-04-11 Thread Michael Michael
I have yet to find a solution for this issue I have tried multiple things that I have found on google, but yet have i found a solution. If someone could help me and point me in the right direction I would be much appreciated. Thanks. rake aborted! uninitialized constant Mysql::Error ** Invoke

[Rails] Re: Reloading controller plugins on each request

2010-04-11 Thread Frederick Cheung
On Apr 11, 7:42 pm, Nick wrote: > > However, every request other than the first results in this error: >     "undefined local variable or method `acts_as_dashboard' for > DashboardsController:Class" > citing line 2 of app/controllers/dashboards_controller.rb : >     1 class DashboardsController

[Rails] Re: test database and migrations

2010-04-11 Thread Grary
Thanks guys. What's strange to me is the idea that Rails testing is not comprehensive, i.e., there are constants, e.g., zip codes, that you will use in production that you didn't have access to in testing. While I appreciate that testing is built on cases and not exhaustive, I can think of situati

[Rails] complete validation failures

2010-04-11 Thread badnaam
All the validations fail, even though the values in the params[] are valid. Here is the error in the logs, this is very weird frustrating, this should be pretty straightforward rails version 2.3.5 Model => class LoyaltyBenefit < ActiveRecord::Base belongs_to :merchant validates_inclusi

Re: [Rails] test database and migrations

2010-04-11 Thread Anthony Crumley
Grar, My recommendation would be to not pre-populate with a migration. I would create a ruby script for that and have developers run that script to get setup. Then I would run that script in the test/test_helper.rb setup or where ever is appropriate if I wanted that data available in my tests.

[Rails] Re: please help; form_for passes nil

2010-04-11 Thread Fearless Fool
@dirtbug: I'm somewhat a newcomer myself, but found this article: http://jeremyhubert.com/articles/debugging-in-rails.html to be particularly helpful. It shows simple strategies for debugging views, controllers and models. Myself, I've gotten good mileage out of judiciously placed calls to "

Re: [Rails] Export contents to Word DOC file

2010-04-11 Thread bill walton
Hi Ahmed, On Sun, 2010-04-11 at 19:05 +0200, Ahmed Abdelsalam wrote: > Hi, > > I want to export some contents from my rails application to MS WORD .doc > file > > Any help? Google 'rails create word doc'. Best regards, Bill -- You received this message because you are subscribed to the Googl

[Rails] Re: Reloading controller plugins on each request

2010-04-11 Thread Nick
On Apr 11, 2:42 pm, Nick wrote: > Hey Frederick. Thanks for the tip. That makes sense. It turns out that > I didn't completely solve the problem of the plugin reloading, and I > think what you described is the culprit. > > For some reason, ActsAsDashboard::ClassMethods is not being reloaded > for

[Rails] Re: Reloading controller plugins on each request

2010-04-11 Thread Nick
Hey Frederick. Thanks for the tip. That makes sense. It turns out that I didn't completely solve the problem of the plugin reloading, and I think what you described is the culprit. For some reason, ActsAsDashboard::ClassMethods is not being reloaded for each request. I tried your suggestion of ch

Re: [Rails] Image preloading

2010-04-11 Thread Christophe Decaux
I'm just a rails amateur, but I've been dealing with Prototype stuff a bit longer and I bumped into this image preloading stuff already. I don't clearing understand what you want to do while your images are preloading and also what you want to do once they are preloaded and this is pretty crucial a

[Rails] Export contents to Word DOC file

2010-04-11 Thread Ahmed Abdelsalam
Hi, I want to export some contents from my rails application to MS WORD .doc file Any help? -- Posted via http://www.ruby-forum.com/. -- 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-t...

Re: [Rails] Re: Image preloading

2010-04-11 Thread steve ross
On Apr 11, 2010, at 4:15 AM, ChaosKnight wrote: > > On Apr 11, 3:43 am, steve ross wrote: >> On Apr 10, 2010, at 9:32 AM, ChaosKnight wrote: >> >>> Hi, I am still very new to Ruby on Rails, but I'm busy with my first >>> RoR website, everything went well, until I realized that my images >>> didn

[Rails] Re: Moving to Widgets from Standard Rails UI

2010-04-11 Thread Smart RoR
Steffen wrote: > I think it depends on the application / website you want to build. > For me and the applications I built with it, Ext JS and Rails have > been the perfect combination. > > Not sure what you mean with losing a lot of the magic of Rails. > I'm not a fan of erb/haml, partials and rjs

[Rails] Re: How to convert a "time difference" into "x days, y hours..."

2010-04-11 Thread Tom Ha
Great! Thanks a lot, guys! -- Posted via http://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to r

Re: [Rails] How to convert a "time difference" into "x days, y hours..."

2010-04-11 Thread Philip Hallstrom
Hi there, how can I convert something like... future_datetime - past_datetime (which results in a float) into something like... "21 days, 2 hours, 53 minutes, 1 seconds" ? Does RoR have any nifty helper for this ? Not that I know of, but there's examples out there... http://www.google.c

[Rails] Re: How to convert a "time difference" into "x days, y hours..."

2010-04-11 Thread Frederick Cheung
On Apr 11, 4:48 pm, Tom Ha wrote: > Hi there, > > how can I convert something like... > >   future_datetime - past_datetime  (which results in a float) > > into something like... > >   "21 days, 2 hours, 53 minutes, 1 seconds" ? > Have a look at distance_of_time_in_words http://api.rubyonrails.

[Rails] Re: Moving to Widgets from Standard Rails UI

2010-04-11 Thread Steffen
Sorry, somehow didn't see the original message. Smart RoR, I love the clean separation of controllers and views you get when working with Ext JS. You basically build an API for your app right away. So in case your app needs an API for third party stuff later, you already have that, you just need

[Rails] Re: Moving to Widgets from Standard Rails UI

2010-04-11 Thread Steffen
I think it depends on the application / website you want to build. For me and the applications I built with it, Ext JS and Rails have been the perfect combination. Not sure what you mean with losing a lot of the magic of Rails. I'm not a fan of erb/haml, partials and rjs. The true magic for me in

[Rails] How to convert a "time difference" into "x days, y hours..."

2010-04-11 Thread Tom Ha
Hi there, how can I convert something like... future_datetime - past_datetime (which results in a float) into something like... "21 days, 2 hours, 53 minutes, 1 seconds" ? Does RoR have any nifty helper for this ? Thanks a lot for any hint! Tom -- Posted via http://www.ruby-forum.com/.

[Rails] Caching html / blobs / ActiveRecords

2010-04-11 Thread Fearless Fool
Short question: what caching packages are available for Rails? Details: My application requires data scraped from various web sites. To date, I've used scripts to fetch the page in question. Since I never want to hit a web site twice with the same query, I always save the raw HTML so I can parse

[Rails] Re: Custom Routes

2010-04-11 Thread 9888888888
map 'countres/:name', :controller => a, :action => b class a < ActiveController def b params[:name] end end -- 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-t...@googlegroups.com. T

[Rails] Administration

2010-04-11 Thread ChaosKnight
Hi everyone, I was wondering about an admin section for websites, would I be better off to separate the admin controllers from the public exposed controllers? At the moment I do this via a namespace, but to me it seems more like a duplication... Is this part of being RESTful? Can you please tell

[Rails] Re: not getting validation error message

2010-04-11 Thread Smart RoR
Rahul Mehta wrote: > i have one comment controller to put comment on article > i have used this form add in my website part or some other > controller > put two validation >validates_presence_of(:name,:comment) > > code of other controller > >@comment = Comment.new >@comm

[Rails] Re: Moving to Widgets from Standard Rails UI

2010-04-11 Thread Smart RoR
Anthony Crumley wrote: > Smart RoR, > > We went down the ExtJS path and it was a painful one. The widgets can > provide a nice user experience but it comes with a high price on the > development side. When you step off the golden path with Rails you lose > a > lot of the magic. We are in the p

[Rails] Re: Controller Tests fail

2010-04-11 Thread Graham Farrell
Hi Samiron, After looking at your relpy again I have edited the user and business yml files to the following. # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html Business one: id: 1 name: Graham's Bar user_id: 1 address: 112 O'Connell Street province: Dublin 1 c

[Rails] Custom Routes

2010-04-11 Thread ChaosKnight
Hi, I am busy with a tourism website and I am almost done, but the URL's is starting to bug me... I am still a Rails noob, but I am eager to learn as much as possible. I already make use of resource routes, but I want to display the paths like this: /countries/ zimbabwe, and: admin/countries/southa

[Rails] Re: Image preloading

2010-04-11 Thread ChaosKnight
On Apr 11, 3:43 am, steve ross wrote: > On Apr 10, 2010, at 9:32 AM, ChaosKnight wrote: > > > > > > > > > Hi, I am still very new to Ruby on Rails, but I'm busy with my first > > RoR website, everything went well, until I realized that my images > > didn't preload... On previous websites I used

[Rails] Re: Controller Tests fail

2010-04-11 Thread Graham Farrell
Samiron Rony wrote: > How did you write your Business and User models? > What you are trying to do is as simple as a relation between User and > Business model. And i guess it should be like the following: > > class User < AR::B > has_many :businesses # or > # has_one :business > end > > cla

[Rails] simple role system through associative table

2010-04-11 Thread Daniel Drehmer
So I have the Ninja model which has many Hovercrafts through ninja_hovercrafts (which stores the ninja_id and the hovercraft_id). It is of my understanding that this kind of arrangement should be set in a way that the associative table stores only enough information to bind two different classes.

[Rails] [ANN] Mail 2.2.0

2010-04-11 Thread Mikel Lindsaar
Mail version 2.2.0 has been pushed to RubyGems.org. I have also updated ActionMailer to use Mail 2.2.0 which removes (finally) all quoting and encoding of mail parts from ActionMailer, the methods in ActionMailer worked for most use cases, but there were a lot of edge cases they did not handle wel

[Rails] Re: Rendering a Partial as an Alternative

2010-04-11 Thread Rahul Mehta
Hi Anthony , Thanks for reply, its good to know that exception handling in rails is done like this. thanks Rahul On Apr 10, 2:05 pm, Rahul Mehta wrote: > Hi Anthony, > > <% begin %> >   <%= render :partial => 'custom' %> > <% rescue ActionView::MissingTemplate %> >   Default > <% end %> > > wh

[Rails] not getting validation error message

2010-04-11 Thread Rahul Mehta
i have one comment controller to put comment on article i have used this form add in my website part or some other controller put two validation validates_presence_of(:name,:comment) code of other controller @comment = Comment.new @commentgiven=Comment.find(:all,:conditions