[Rails] Re: How to create embedding code in ror

2010-06-08 Thread Yudi Soesanto
What I am trying to do is: I creating a survey website. User can register to create a survey and this survey can be embedded to other site with providing embedded script. The problem I have, I don't know how to create embedded code via ruby on rails. I never done this. Please help!!! Thanks, Y

[Rails] Re: OT: Rubygems.org down?

2010-06-08 Thread Ricardo Sanchez
I had problems most of the afternoon here in the US with gems located at rubygems.org. Hopefully will be fixed tomorrow. There's gotta be some kinda of redundancy/mirroring provided by this site or at least and indication on the site about the DNS operational status. - Ricardo On Jun 8, 8:19 am,

[Rails] Re: Hosting Ruby on Rails on GoDaddy - Solved!

2010-06-08 Thread Aashish Kiran
Hi, I want to launch a rails application on godaddy. I purchased a domain and a hosting plan. I really could not understand from where and how to start to deploy rails application . Can anyone please tell how to proceed. thank you aashish -- Posted via http://www.ruby-forum.com/. -- You rec

[Rails] Re: ajax and redirect

2010-06-08 Thread tonypm
With my search forms, I use two partials, one for the controls and one for the result and then just use a page update to redisplay both parts. If you really want a redirect On Jun 6, 11:25 am, javinto wrote: > format.js { >           render :action=> search_show, :layout=>false >         } >

[Rails] rails+sinatra sent image

2010-06-08 Thread Bohdan Pohoriletz
Hi! I have simple rails application - users with name and avatar and in sinatra I want to create new user. form for new user Name: Avatar: My action in sinatra post '/users/create' do RestClient.post("http://localhost:3000/users";, :user=>params['use

[Rails] Re: How to create embedding code in ror

2010-06-08 Thread Marnen Laibow-Koser
Yudi Soesanto wrote: > Hi guys, > > Could you give me a sample or link for creating embedding code in ruby > on > rails? What do you mean by "embedding code"? > > Thanks, > Yudi Soesanto --  Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org Sent from my iPhone -- Posted via http

[Rails] Re: ruby script/plugin install not working

2010-06-08 Thread pedrito rod
the plugin is...2dc_jqgrid.git -- 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 rubyonrail

[Rails] How to create embedding code in ror

2010-06-08 Thread Yudi Soesanto
Hi guys, Could you give me a sample or link for creating embedding code in ruby on rails? Thanks, Yudi Soesanto -- 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 u

[Rails] Re: authenticity_token shows up in the url when page reloads

2010-06-08 Thread Stephen Kilbourn
Nevermind, I got it... Still couldn't have gotten it without your help. Thanks. -- 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

Re: [Rails] Re: rake tells me to install gems that are already there

2010-06-08 Thread Ali Akhtarzada
Hey thanks for the heads up! I couldn't figure out what to put in the ENV['GEM_PATH'], I tried ENV['GEM_PATH'] = '$GEM_HOME:/usr/lib/ruby/gems/1.8' but I was still getting the error. I used rake gems:unpack in my application and then pushed it onto the server and that seems to work fine. I'm a li

[Rails] Re: Rails 3 queries

2010-06-08 Thread Bryan Ash
Not sure how I deluded my self into believing that worked, but it didn't. I still can't figure out how to build this query. Either Google doesn't want to be my friend or I'm asking the wrong question. Does anyone know of any blogs/tutorials that cover Rails 3 has_many :through queries? -- You

[Rails] [JOB] Rails Developer, NYC | 12+ month contract

2010-06-08 Thread OSS
This is a full time, on-site, contract/hourly gig that lasts at least 12 months in New York City. No telecommuting allowed. A well funded start up is urgently looking for 2-3 talented developers with expert knowledge of ROR. This is a long term engagement that can lead to full time employment, w

[Rails] Re: Re: Visual Effect: insert new stuff, then slide open

2010-06-08 Thread Chris Kalaboukis
Piyush Choudhary wrote: > try this, if it helps > http://wiki.github.com/madrobby/scriptaculous/combination-effects-demo Hi Piyush: I tried that. I can't get it to move down smoothly... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Goo

[Rails] Re: authenticity_token shows up in the url when page reloads

2010-06-08 Thread Stephen Kilbourn
Peter De Berdt wrote: > Downloading a file is a "full page refresh" (although the page won't > actually refresh). You shouldn't use an AJAX function (whether that's > a link or a form) to send a file to the client. Just serve it up with > the right content type as a normal request and you'll be fin

[Rails] Re: rake tells me to install gems that are already there

2010-06-08 Thread Sheldon Finlay
Most likely your application is looking for the gems at the server level rather than the user level. Here's a KB article from hostmonster.com describing what you need to do: http://helpdesk.hostmonster.com/index.php/kb/article/000365 Cheers, Sheldon Finlay On Jun 8, 8:20 pm, Ali wrote: > Hi, I

[Rails] rake tells me to install gems that are already there

2010-06-08 Thread Ali
Hi, I've on hostmonster.com and i've run into a small problem that I just can't get. When I push my application into my hosting environment and try to run rake db:migrate, I get an error message from rake telling me to install the missing gem my environment.rb file has: config.gem "formtastic" con

Re: [Rails] Re: string attributes not showing up in view

2010-06-08 Thread Ali Akhtarzada
Oh ok. Did not know that. Thanks! After I got rid of the '@' part they were still returning nil. I had an attr_accessor :first_name, :last_name defined. Things worked after getting rid of that. I guess having attr_Accessor with the same names overrides the method calls or something? Thanks again!

[Rails] How do I set session_id cookies securely on an http page?

2010-06-08 Thread Skye Weir-Mathews
I added ActionController::Base.session_options[:secure] = true to ~/config/environments/production.rb and now my app sets a different session_id cookie on every request to a non ssl page, making the session useless. If my session_id cookie is set by a request to a https page, and I stay on http

[Rails] session_options[:secure] resets session_id on every request

2010-06-08 Thread Skye Weir-Mathews
I'm working on an ecommerce site (in Rails 2.3) and I added: ActionController::Base.session_options[:secure] = true to ~/config/environments/production.rb Now, every time I add something to my shopping cart and navigate away I get a new session_id (which essentially empties my shopping cart). H

Re: [Rails] Rails crashes when running more than 1 instance..

2010-06-08 Thread Norm Scherer
Hassan Schroeder wrote: On Tue, Jun 8, 2010 at 5:44 AM, MnrKaktus wrote: The problem I have is that when I open a second, different, rails app on one server, the ruby proces crashes. I've searched google for "EADDRINUSE (Address already in use)" but I can't f

[Rails] Re: launch error

2010-06-08 Thread E. Litwin
Do you have the rack -v 1.0.1 gem installed? On Jun 8, 12:41 pm, anon_comp wrote: > On Jun 6, 6:10 am, Mike Peltzer wrote: > > > > > > > Hey all, I am just getting started with RoR and am having trouble > > launching the localhost:3000 page. Here is the error message I am > > getting in my comma

[Rails] Re: Jndi access issue when using threads in rails application deployed in websphere (WAS)

2010-06-08 Thread Robert Walker
rakmoh wrote: > I need to deploy my application to Websphere (WAS) 6.1. Application > uses threads for some back-groud work. When I deploy the war in WAS, I > am getting the following error: You should post this to the JRuby forum instead. You'll probably get more help there. -- Posted via http:

[Rails] Jndi access issue when using threads in rails application deployed in websphere (WAS)

2010-06-08 Thread rakmoh
I need to deploy my application to Websphere (WAS) 6.1. Application uses threads for some back-groud work. When I deploy the war in WAS, I am getting the following error: [5/3/10 15:56:57:616 EDT] 008f SystemErr R JNDI data source unavailable: javax.naming.ConfigurationException: A JNDI operati

[Rails] Re: Render an action if coming from ajax request

2010-06-08 Thread Greg Ma
I don't understand, I've been testing on Firefox and now I am on Safari and it works... Someone has an idea why? -- 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

Re: [Rails] Re: rails, ajax, json, and script

2010-06-08 Thread Colin Law
On 8 June 2010 21:06, Hassan Schroeder wrote: > On Tue, Jun 8, 2010 at 12:51 PM, Ralph Shnelvar wrote: > >> What is all this header and body stuff?  I'd really like to understand >> this. > > Start with: http://www.w3.org/Protocols/rfc2616/rfc2616.html I think that may be a bit heavy for starter

Re: [Rails] Re: Re: Re: Can a dropdown be used to select additional form fi

2010-06-08 Thread Colin Law
On 8 June 2010 20:45, Steve Russo wrote: > Colin Law wrote: >> On 8 June 2010 18:40, Steve Russo wrote: >>> sure why. �If I do a simple reload/refresh on the browser, the values >>> within the partials are preserved, but not when a validation error >>> occurs. >>> >>> Any thoughts on what the val

Re: [Rails] Re: rails, ajax, json, and script

2010-06-08 Thread Hassan Schroeder
On Tue, Jun 8, 2010 at 12:51 PM, Ralph Shnelvar wrote: > What is all this header and body stuff?  I'd really like to understand > this. Start with: http://www.w3.org/Protocols/rfc2616/rfc2616.html -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You

[Rails] Re: rails, ajax, json, and script

2010-06-08 Thread Ralph Shnelvar
Frederick Cheung wrote: > On Jun 8, 4:51�pm, Ralph Shnelvar wrote: > >> >> Do you know of any tutorial that explains this header stuff? > > Setting headers is pretty easy: > > response.headers['X-JSON'] = blah.to_json > > And then in your client side code look at the the header and read the >

[Rails] Re: Select question?

2010-06-08 Thread Lamer Lamer
> Did you try ... > > <%= select( :order, :hcins, [["Man", 3], ["Is", 5]]) %> > > > > ~Jeremy yeah I tried and faced with same result. -- 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 pos

[Rails] Re: Re: Re: Can a dropdown be used to select additional form fi

2010-06-08 Thread Steve Russo
Colin Law wrote: > On 8 June 2010 18:40, Steve Russo wrote: >> sure why. �If I do a simple reload/refresh on the browser, the values >> within the partials are preserved, but not when a validation error >> occurs. >> >> Any thoughts on what the validation may be doing that clears the dynamic >> pa

[Rails] Re: launch error

2010-06-08 Thread anon_comp
On Jun 6, 6:10 am, Mike Peltzer wrote: > Hey all, I am just getting started with RoR and am having trouble > launching the localhost:3000 page. Here is the error message I am > getting in my command prompt: > > C:\Users\Michael\rubydev\ch04\first>ruby script/server > C:/Ruby19/lib/ruby/site_ruby

[Rails] Re: Params from form & condition in request

2010-06-08 Thread Marnen Laibow-Koser
Stanislav Orlenko wrote: > Hi > I have a form on View and I have to construct condition for query > depending fields which user filled in form. > I should write something like: > > cond > if params[par1] > cond = " par1 = #{par1} " > > if params[par2] > cond += " AND par2 = #{par2} " > NO! N

[Rails] Params from form & condition in request

2010-06-08 Thread Stanislav Orlenko
Hi I have a form on View and I have to construct condition for query depending fields which user filled in form. I should write something like: cond if params[par1] cond = " par1 = #{par1} " if params[par2] cond += " AND par2 = #{par2} " etc Client.all(:conditions => cond) May

[Rails] Re: Paperclip/ImageMagick issue

2010-06-08 Thread Jeremy Woertink
catz wrote: > Paperclip.options[:image_magick_path] = "/opt/local/bin" > Paperclip.options[:command_path] = "/opt/local/bin" > > add something like these two commands to paperclip.rb in initializers > folder > > just point to right identify command path The second one worked. I guess the first

Re: [Rails] Re: Re: Can a dropdown be used to select additional form fi

2010-06-08 Thread Colin Law
On 8 June 2010 18:40, Steve Russo wrote: > It seems I have this working using the approach of rendering all of the > partials and then hiding/displaying the div as needed.  I was able to > get this to partially work in the past with an RJS file using Marnen's > suggestion of using a separate form

Re: [Rails] Paperclip/ImageMagick issue

2010-06-08 Thread catz
Paperclip.options[:image_magick_path] = "/opt/local/bin" Paperclip.options[:command_path] = "/opt/local/bin" add something like these two commands to paperclip.rb in initializers folder just point to right identify command path On 6/8/10, Philip Hallstrom wrote: > Is JPG support compiled into

[Rails] Re: Paperclip/ImageMagick issue

2010-06-08 Thread Jeremy Woertink
Philip Hallstrom wrote: > Is JPG support compiled into Imagemagick? > > If you run identify directly on your image does it work? Or complain? I ran the little test that generates the logo.gif. jeremywoertink$ /usr/local/bin/convert logo: logo.gif The logo shows up fine, and I can upload it as m

Re: [Rails] Paperclip/ImageMagick issue

2010-06-08 Thread Philip Hallstrom
Is JPG support compiled into Imagemagick? If you run identify directly on your image does it work? Or complain? On Jun 8, 2010, at 9:25 AM, Jeremy Woertink wrote: > I'm using paperclip for uploading images, and I'm running into a weird > error: > > > 2 errors prohibited this billboard from be

[Rails] Re: Re: Can a dropdown be used to select additional form fi

2010-06-08 Thread Steve Russo
It seems I have this working using the approach of rendering all of the partials and then hiding/displaying the div as needed. I was able to get this to partially work in the past with an RJS file using Marnen's suggestion of using a separate form builder within each of the partials. This was

[Rails] Re: Select question?

2010-06-08 Thread Jeremy Woertink
Lamer Lamer wrote: > view > <%= select( :order, :hcins, { "Man" => 3, "Is" => 5}) %> > (hcins is string value) > > controller (order) > > def create > > @order =Order.new(params[:order]) > > @order.user = User.find(session[:user_id]) > > @order.ucret= @order.hcins.to_d * @order.hboy > >

[Rails] Select question?

2010-06-08 Thread Lamer Lamer
view <%= select( :order, :hcins, { "Man" => 3, "Is" => 5}) %> (hcins is string value) controller (order) def create @order =Order.new(params[:order]) @order.user = User.find(session[:user_id]) @order.ucret= @order.hcins.to_d * @order.hboy if @order.save redirect_to :controller=>"

[Rails] Re: Problem with saving object (on heroku hosting)

2010-06-08 Thread Frederick Cheung
On Jun 8, 6:04 pm, catz wrote: > Frederick thanks It was my mistake. Reopen for Contact was in my project. > > I added an error model and forgot. Following code was there > request_contact.rb file > class Contact < ActiveRecord::Base >   belongs_to :request >   belongs_to :contact > .. > > Inter

Re: [Rails] Re: Problem with saving object (on heroku hosting)

2010-06-08 Thread catz
Frederick thanks It was my mistake. Reopen for Contact was in my project. I added an error model and forgot. Following code was there request_contact.rb file class Contact < ActiveRecord::Base belongs_to :request belongs_to :contact .. Interesting moment here is that this reopening doesn't ap

[Rails] Paperclip/ImageMagick issue

2010-06-08 Thread Jeremy Woertink
I'm using paperclip for uploading images, and I'm running into a weird error: 2 errors prohibited this billboard from being saved There were problems with the following fields: * Image /var/folders/bh/bh5FVAlvF5C38oqg94dcbU+++TI/-Tmp-/stream.1605.0 is not recognized by the 'identify' command

[Rails] Re: Rails crashes when running more than 1 instance..

2010-06-08 Thread Saurabh Peshkar
Hi Tim, If you are using Fedora try following command in terminal: console$> ps -fu USER PID %CPU %MEMVSZ RSS TTY STAT START TIME COMMAND user 3429 0.0 0.0 5072 1672 pts/1Ss Jun08 0:00 bash user 15217 2.0 0.0 4628 908 pts/1R+ 03:17 0:00 \_ ps -fu

Re: [Rails] Rails crashes when running more than 1 instance..

2010-06-08 Thread Hassan Schroeder
On Tue, Jun 8, 2010 at 5:44 AM, MnrKaktus wrote: > The problem I have is that when I open a second, different, rails app > on > one server, the ruby proces crashes. > I've searched google for "EADDRINUSE (Address already in use)" but I > can't find a solution.. Seriously? It means exactly what

[Rails] Re: rails, ajax, json, and script

2010-06-08 Thread Frederick Cheung
On Jun 8, 4:51 pm, Ralph Shnelvar wrote: > > Do you know of any tutorial that explains this header stuff? Setting headers is pretty easy: response.headers['X-JSON'] = blah.to_json And then in your client side code look at the the header and read the JSON (prototype will do this for you, jque

[Rails] Re: rails, ajax, json, and script

2010-06-08 Thread Ralph Shnelvar
Frederick Cheung wrote: > On Jun 8, 3:56�pm, Ralph Shnelvar wrote: >> Frederick Cheung wrote: >> > On Jun 8, 3:00 pm, Ralph Shnelvar wrote: > >> Fred: >> >> Ok ... lets say I have two variables ABC and XYZ and I want to send the >> values of those two variables back to my jQuery code ... >> >> W

[Rails] need help Inplace editor text area size

2010-06-08 Thread Vidyasagar Hk
I am trying to rename a bundle name I got a textarea box with row size 3 column size 40 but I need a small text box Please help me <%= in_place_editor('edit_title_bundle'+bundle.id.to_s, :url => update_field_newsfeeds_path(:id => bundle.id, :name =>'category'), :rows => 2 , :size => 50 , :save_te

[Rails] Re: Validate in controller or use Rails validations?

2010-06-08 Thread MarkB
Thanks everyone. Makes sense. Better to build validation logic once in the model than try to add redundant code across controllers. I wanted to ask before I started off on a bad path. Mark On Jun 8, 4:58 am, Marnen Laibow-Koser wrote: > MarkB wrote: > > As I prepare to add validations to my a

[Rails] Re: OT: Rubygems.org down?

2010-06-08 Thread Gernot Ullrich
Klaus-dieter Gundermann wrote: > Michael Pavling wrote: >> Not specifically a Rails problem; but is anyone else having problems >> accessing http://rubygems.org or installing gems? >> >> It's not working for me from my home internet (in the UK), internet on >> my phone, or a VM in Chicago... >> >

[Rails] Re: rails, ajax, json, and script

2010-06-08 Thread Frederick Cheung
On Jun 8, 3:56 pm, Ralph Shnelvar wrote: > Frederick Cheung wrote: > > On Jun 8, 3:00 pm, Ralph Shnelvar wrote: > Fred: > > Ok ... lets say I have two variables ABC and XYZ and I want to send the > values of those two variables back to my jQuery code ... > > What's the magic invocation to do tha

[Rails] Re: Problems using Globalize 2 crud with rails 2.3 nested attributes

2010-06-08 Thread Gerald Müller
The association name changed from :globalize_translations to :translations. Maybe is this is your problem? -- 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 ru

[Rails] Re: rails, ajax, json, and script

2010-06-08 Thread Ralph Shnelvar
Frederick Cheung wrote: > On Jun 8, 3:00�pm, Ralph Shnelvar wrote: >> Could someone please demonstrate the code to send both json (or xml) AND >> javascript (to be executed) in a single Ajax request? >> > > Assuming you mean sending that as the response to an ajax request > > If you set the

Re: [Rails] Re: Problem with saving object (on heroku hosting)

2010-06-08 Thread catz
Definitely not. The project is the same. I'm just git push it. o.k i'll dig into prod vs dev mode and try to see the difference. Anyway thanks a lot for your attention. On 6/8/10, Frederick Cheung wrote: > > > On Jun 8, 1:37 pm, Roman Catz wrote: > >> >> There are different numbers of methods. W

[Rails] Re: Re: Update Realtion

2010-06-08 Thread Markus Wellmann
The answer is Continent.find(params[:product]["continent_id"]) in more Steps first=params[:product] second=first["continent_id"] Continent.find(secon) May be there is a better way as well but any way it works finally. thanks to for Helping to get on the right way! Markus Wellmann wrote: in def

[Rails] Re: Render an action if coming from ajax request

2010-06-08 Thread Greg Ma
Frederick Cheung wrote: > On Jun 8, 10:15�am, Greg Ma wrote: > >> >> Yes I have check the log and it doesn't help. I logged each step and I >> confirm that it is not an Ajax request... >> > Rails looks at the X-Requested-With header to see if a request was an > ajax one. Prototype, jquery etc. se

[Rails] Re: rails, ajax, json, and script

2010-06-08 Thread Frederick Cheung
On Jun 8, 3:00 pm, Ralph Shnelvar wrote: > Could someone please demonstrate the code to send both json (or xml) AND > javascript (to be executed) in a single Ajax request? > Assuming you mean sending that as the response to an ajax request If you set the X-JSON header to be a json fragmen

[Rails] rails, ajax, json, and script

2010-06-08 Thread Ralph Shnelvar
Could someone please demonstrate the code to send both json (or xml) AND javascript (to be executed) in a single Ajax request? Is this even possible? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" gro

[Rails] Re: Accessing a class's variables from an included module

2010-06-08 Thread Yanni Mac
Michael Pavling wrote: > On 7 June 2010 20:42, Yanni Mac wrote: >> class ShirtProduct < ActiveRecord::Base >> end >> >> class PantsProduct < ActiveRecord::Base >> end > > And have you *really* designed to have a different table for different > types of product? I can only imagine lots of pain tha

[Rails] Re: Advise wanted on Ror software development and project m

2010-06-08 Thread Robert Walker
Marnen Laibow-Koser wrote: > OK, apparently we're not hearing each other. Gitosis setup is simple, > and it gives you a ridiculously easy way of managing users' keys. Even > for my solo freelance business, I can't imagine *not* using Gitosis. > When you have two users -- and if you have Cap, y

[Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Max Williams
Frederick Cheung wrote: > On Jun 8, 2:21�pm, Max Williams wrote: > >> > Fred >> >> In this case, i have a page which loads a partial twenty times. �Each >> partial calls a method on the user object (current_user as it happens) >> which inspects its associated role object. So, if i don't eager loa

[Rails] Rails crashes when running more than 1 instance..

2010-06-08 Thread MnrKaktus
Hello everyone, I'm new here, and I wasn't sure where to put this question. So forgive me if this is the wrong place. The problem I have is that when I open a second, different, rails app on one server, the ruby proces crashes. When I checkout the ruby process this is the loop it hangs in: rt_si

[Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Frederick Cheung
On Jun 8, 2:21 pm, Max Williams wrote: > > Fred > > In this case, i have a page which loads a partial twenty times.  Each > partial calls a method on the user object (current_user as it happens) > which inspects its associated role object. So, if i don't eager load, > then the role gets loaded

Re: [Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Michael Pavling
On 8 June 2010 14:21, Max Williams wrote: > > In this case, i have a page which loads a partial twenty times.  Each > partial calls a method on the user object (current_user as it happens) > which inspects its associated role object. So, if i don't eager load, > then the role gets loaded twenty ti

Re: [Rails] Re: string attributes not showing up in view

2010-06-08 Thread Michael Pavling
On 8 June 2010 13:56, Marnen Laibow-Koser wrote: > pepe wrote: >> On Jun 8, 3:10�am, Michael Pavling wrote: >>> ��def full_name >>> �� �[first_name, last_name].join(" ") >>> ��end >>> >>> ...now, if you're missing a first or last name, you don't get extra >>> white-space padding > > Actually, I b

[Rails] Re: Re: Update Realtion

2010-06-08 Thread Markus Wellmann
Marnen Laibow-Koser wrote: > You're trying to pass a symbol instead of a variable into your query > string, so of course it won't work. What you want is > ["id = ?", continent_id.to_i] (without the colon). > > But you should never need to do it this way. For a simple equality > check, use the

[Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Max Williams
Frederick Cheung wrote: > On Jun 8, 12:09�pm, Max Williams wrote: >> Frederick Cheung wrote: >> > One addition - it's pointless doing this unless you have more than 1 >> > user object - it won't be any faster >> >> > Fred >> >> Thanks fred - that works. �Faster than what, though? �Than my approach

[Rails] Re: ActiveRecord.find - Association Not Found Error When Using Custom Joins

2010-06-08 Thread neufelni
It looks like you are right Fred, the code doesn't actually handle a mixture of strings and associations. I found the following patch to fix the problem: http://groups.google.ca/group/rubyonrails-core/browse_thread/thread/50339b16ca736500 Thanks, neufelni On Jun 7, 12:11 pm, Frederick Cheung wro

[Rails] Re: string attributes not showing up in view

2010-06-08 Thread Marnen Laibow-Koser
pepe wrote: > On Jun 8, 3:10�am, Michael Pavling wrote: >> ��def full_name >> �� �[first_name, last_name].join(" ") >> ��end >> >> ...now, if you're missing a first or last name, you don't get extra >> white-space padding Actually, I believe you do, unless you compact the array first (posting f

[Rails] Re: Problem with saving object (on heroku hosting)

2010-06-08 Thread Frederick Cheung
On Jun 8, 1:37 pm, Roman Catz wrote: > > There are different numbers of methods. Why? What are the methods > contact and contact= for Contact class? Are you re-opening the Contact class anywhere? Is the difference local versus heroku or development versus production mode (in production mode al

[Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Frederick Cheung
On Jun 8, 12:09 pm, Max Williams wrote: > Frederick Cheung wrote: > > One addition - it's pointless doing this unless you have more than 1 > > user object - it won't be any faster > > > Fred > > Thanks fred - that works.  Faster than what, though?  Than my approach? compared to not eagerloading

[Rails] Re: Re: Update Realtion

2010-06-08 Thread Marnen Laibow-Koser
Markus Wellmann wrote: > You are right there was a typo but didn't change anything. > to make sure I tried :id.to_i witch brings 3049 instead of 1 > >>> -:first, :conditions => [ "id = ?",:continend_id.to_i ]) //the same then >> You're trying to pass a symbol instead of a variable into your que

[Rails] Re: Problem with saving object (on heroku hosting)

2010-06-08 Thread Roman Catz
Here is some additional notes: If anybody know please explain: class Contact < ActiveRecord::Base belongs_to :user belongs_to :contact_type, :class_name => "ContactType", :foreign_key => "contact_type_id" has_many :request_contacts, :dependent => :destroy has_many :requests, :through => :

[Rails] Re: gem install mysql giving error on linux

2010-06-08 Thread Tushar Gandhi
Hi, I solved the issue. I forgot to install "mysql-delop" client. My problem I was working on windows since last 2 years. I moved to linux now and I am facing lot of problem for installation. I don't why the installation process for platforms is different as well as cumbersome to install. Anyon

[Rails] Re: Re: Update Realtion

2010-06-08 Thread Markus Wellmann
You are right there was a typo but didn't change anything. to make sure I tried :id.to_i witch brings 3049 instead of 1 >> -:first, :conditions => [ "id = ?",:continend_id.to_i ]) //the same then > > Are you sure it's not just a typo? > > continend_id vs continent_id -- Posted via http://www.r

[Rails] Re: OT: Rubygems.org down?

2010-06-08 Thread Klaus-dieter Gundermann
Michael Pavling wrote: > Not specifically a Rails problem; but is anyone else having problems > accessing http://rubygems.org or installing gems? > > It's not working for me from my home internet (in the UK), internet on > my phone, or a VM in Chicago... > > Having not seen anyone complaining abo

[Rails] Re: Validate in controller or use Rails validations?

2010-06-08 Thread Marnen Laibow-Koser
MarkB wrote: > As I prepare to add validations to my application, I am trying to > decide if it would be better to write validation logic in the update/ > create controller methods or use Rails' validation methods. Use Rails' validation methods. Logic like that does not belong in the controller.

Re: [Rails] Re: Update Realtion

2010-06-08 Thread Bill Walton
Hi Marcus, On Tue, Jun 8, 2010 at 6:39 AM, Markus Wellmann wrote: > Thanks for your answer. You're welcome. > -:first, :conditions => [ "id = ?",:continend_id.to_i ]) //the same then Are you sure it's not just a typo? continend_id vs continent_id Best regards, Bill -- You received this mes

[Rails] Re: Update Realtion

2010-06-08 Thread Markus Wellmann
Thanks for your answer. I tried already: :params[:continent_id] //Error: Couldn't find Continent with ID=0 the problem is that :continent_id is the foreign key in products and i'm looking for the :id in continents which is the same then :continent_id I also tried to use: -:params[:continent_id]

[Rails] Re: How to refer to birthday(1i) in a AR

2010-06-08 Thread ShellScripter
Thx a lot , that's true , it just was my mistake ... :o > You shouldn't need to  - as long as you use date_select (with the > attribute name birthdate) and then pass that into User.new (or > User.update_attributes etc.) activerecord will do the work of sticking > the individual parameters back toge

[Rails] OT: Rubygems.org down?

2010-06-08 Thread Michael Pavling
Not specifically a Rails problem; but is anyone else having problems accessing http://rubygems.org or installing gems? It's not working for me from my home internet (in the UK), internet on my phone, or a VM in Chicago... Having not seen anyone complaining about it this morning makes me wonder if

[Rails] Re: Problem with saving object (on heroku hosting)

2010-06-08 Thread Roman Catz
Yes of course, currently it looks like validates_presence_of :contact_type_id validates_associated :contact_type I insert some debug on the view and get something: please look into it :) <% form_for(@contact) do |f| %> <%= debug(@contact) %> The difference here is under changed_attribute

[Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Max Williams
Frederick Cheung wrote: > One addition - it's pointless doing this unless you have more than 1 > user object - it won't be any faster > > Fred Thanks fred - that works. Faster than what, though? Than my approach? -- Posted via http://www.ruby-forum.com/. -- You received this message because

Re: [Rails] Update Realtion

2010-06-08 Thread Bill Walton
Hi Ma We, On Tue, Jun 8, 2010 at 5:23 AM, Ma We wrote: > The parameters of my update are looking like this: > Parameters: {"commit"=>"Update", "action"=>"update", "_method"=>"put", > "authenticity_token"=>"***", "product"=>{"image_url"=>"w.jpg", > "expirience_points"=>"0", "price"=>"1", "title"=

[Rails] Re: Problem with saving object (on heroku hosting)

2010-06-08 Thread Frederick Cheung
On Jun 8, 10:59 am, Roman Catz wrote: > Thanks Frederick, but I still do not understand what's going on here. > > I changed this line to belongs_to :contact_type .. > The result is the same. Did you also change the validates_presence_of :type ? Fred > > Controller was generated as standart s

[Rails] Re: gem install mysql giving error on linux

2010-06-08 Thread Frederick Cheung
On Jun 8, 10:43 am, Tushar Gandhi wrote: > Hi, > I have mysql installed on linux. Whenever I am trying t > "gem install mysql -- --with-mysql-dir=/usr/bin/mysql" > I am getting following error:- > Do you have the mysql header files ? Fred -- You received this message because you are subscribe

[Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Frederick Cheung
On Jun 8, 11:41 am, Frederick Cheung wrote: > On Jun 8, 11:25 am, Max Williams wrote: > then you can do > > User.preload_associations [user1, user2, user3], :role > One addition - it's pointless doing this unless you have more than 1 user object - it won't be any faster Fred -- You received t

[Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Frederick Cheung
On Jun 8, 11:25 am, Max Williams wrote: > Max Williams wrote: > > Let's say that i have a User object in @user, already loaded.   I want > > to constantly refer to @user.role on a particular page (where User > > belongs_to :role), so i want to 'eager load' the role association. > > > For the sak

[Rails] Re: Rails (and MySQL) on Linux - gem install mysql

2010-06-08 Thread Tushar Gandhi
Hi, I am also getting same error. I tried all options but still error is there. Can anyone point me to correct answer? I don't why the rails have this much of trouble. Thanks, Tushar -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google

[Rails] Re: Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Max Williams
Max Williams wrote: > Let's say that i have a User object in @user, already loaded. I want > to constantly refer to @user.role on a particular page (where User > belongs_to :role), so i want to 'eager load' the role association. > > For the sake of argument, let's say i wasn't able to do this in

[Rails] Update Realtion

2010-06-08 Thread Ma We
Hi I want to assign continents to my products with a drop down box. I managed to get everyting runing but now i have a probably quite easy to solve problem. I don't get the update running. What want to do is basically: SELECT * FROM "continents" WHERE ("continents"."id" = "continent_id") LIMIT 1

[Rails] Re: [Rails Heroku] Problem with saving object (on heroku hosting)

2010-06-08 Thread Roman Catz
Thanks Frederick, but I still do not understand what's going on here. I changed this line to belongs_to :contact_type .. The result is the same. Controller was generated as standart scaffold. def create @contact = Contact.new(params[:contact].merge(:user => current_user)) respond_to do |forma

[Rails] Can i eager-load associations onto an already-loaded object?

2010-06-08 Thread Max Williams
Let's say that i have a User object in @user, already loaded. I want to constantly refer to @user.role on a particular page (where User belongs_to :role), so i want to 'eager load' the role association. For the sake of argument, let's say i wasn't able to do this in the normal way (ie with the :

Re: [Rails] Re: How to add dynamic routes to routes.rb. Worked in rails2 doesn't work in rails3

2010-06-08 Thread dennis berger
unfortunately the tests didn't find the routes: 1) Error: test_should_get_about(PageControllerTest): ActionController::RoutingError: No route matches {:action=>"about", :controller=>"page"} /test/functional/page_controller_test.rb:5:in `test_should_get_about' $ rake routes RAILS_ENV=test

[Rails] gem install mysql giving error on linux

2010-06-08 Thread Tushar Gandhi
Hi, I have mysql installed on linux. Whenever I am trying t "gem install mysql -- --with-mysql-dir=/usr/bin/mysql" I am getting following error:- Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /usr/local

[Rails] Re: Render an action if coming from ajax request

2010-06-08 Thread Greg Ma
Frederick Cheung wrote: > Rails looks at the X-Requested-With header to see if a request was an > ajax one. Prototype, jquery etc. set this header, but if phonegap > doesn't then rails won't consider it to be an ajax request > > Fred I'm not making the Ajax query with phonegap but with prototype

Re: [Rails] Re: How to add dynamic routes to routes.rb. Worked in rails2 doesn't work in rails3

2010-06-08 Thread dennis berger
I works now, but I had to add the following to my config/route.rb --- require 'arel' require 'active_model' require 'active_model/observing' Otherwise my route got added but no route at all will work. app.get('/page/about') AND app.get('/') resulted in unintialized constants

[Rails] Re: Render an action if coming from ajax request

2010-06-08 Thread Frederick Cheung
On Jun 8, 10:15 am, Greg Ma wrote: > > Yes I have check the log and it doesn't help. I logged each step and I > confirm that it is not an Ajax request... > Rails looks at the X-Requested-With header to see if a request was an ajax one. Prototype, jquery etc. set this header, but if phonegap doe

[Rails] Re: Render an action if coming from ajax request

2010-06-08 Thread Greg Ma
Colin Law wrote: > On 8 June 2010 09:20, Greg Ma wrote: >> false params[:id].present? >> { >> �method: 'get', >> �onComplete: function(transport){alert('kikoo');} >> } >> ); >> >> I have two problem with this code, the first one is that it doesn't >> recognize that I am making an Ajax request beca

  1   2   >