[Rails] Saving contacts locally

2011-02-22 Thread Bhasker Harihara
Hi All, I want my users to veiw the thumbnail avatar's of their contacts before sending a message. Is it a good idea to store this info on the users pc. so that I can benefit on performance. If the answer to the above question is YES. How can I do it in rails3. Any direction. Regards, -- You

Re: [Rails] nested attributes with belongs_to

2011-02-22 Thread Butu
Thanks Bryan for your reply. For first part of my problem, I am able to figure out the nested attributes with belongs_to. For second part, I am looking for Rails way solution to my problem. Using nested attribute. I can able to create Movie if it does not exist. And able to associate it with so

[Rails] Rails Acts_as_tree and many to many associations (Product, Category) Issue

2011-02-22 Thread Anshu Agr
Hi, I want to create simple many to many association between my product and category model. Category model currently also acts_as_tree for navigation. The code works fine but not sure why after updating product categories, parent category is also inserted repeatedly. This is surprising because new

[Rails] has many to one query

2011-02-22 Thread alexey.Creopolis
-- MODELS -- Model User has_many :profs has_many :skills, :through => :prof Model Prof belongs_to :user # user_id belongs_to :skill # skill_id Model Skill has_many :profs -- CONTROLLER -- searched_skills = [2,18,6] # comes from params[:search_skills] I need to find @users who having ALL of sear

[Rails] Re: Re: Ruby Script to accept Spanish characters

2011-02-22 Thread Zahid Karnekar
Hi Fred & Bryan, Thank you so very much for looking into my query and helping me resolve it. Your hint did the trick. The input file had an ANSI encoding instead of UTF-8. I just changed it and it worked. God bless you both :-) Thanks, Zahid Bryan Crossland wrote in post #983175: > Hi Zahi

[Rails]

2011-02-22 Thread loganathan sellappa
hi all, In my controller, def reg_app a=ApiGroup.find_by_name(params[:id]) b=a.client_applications @clientapp=[] @key=[] @service_profile=[] if !b.nil? for i in 0...b.length do h=b[i].keys @key< 'capp'

[Rails] Re: Can't get .js.erb to work ...

2011-02-22 Thread Niklas Nson
:) I moved the file to /views/javascripts/getlocation.js.erb But there must be something wrong with routes or something else still. If i go to: http://localhost:3000/javascripts/getlocation.js i get a No route matches "/javascripts/getlocation.js" error. [Routes] ModcubeApp::Application.routes.d

[Rails] Re: Beginner Help - Iterating and Displaying From Models with Relationship

2011-02-22 Thread Ryan
Thank you very much everyone! Fred, your advise was spot on. Worked like a charm! <% Company.find(1).applications.each do |app| %> <%= app.name %> <% end %> Perfecto! Clint, thanks for the tip on the inspect function, I missed that. It probably would have been the best way to debug and trial

Re: [Rails] Rails 3 routing problem

2011-02-22 Thread Leonardo Mateo
On Mon, Feb 21, 2011 at 2:15 PM, David J. Hamilton wrote: > Excerpts from Phil Crissman's message of Sun Feb 20 15:14:45 -0800 2011: >> > Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 -0300 >> > >> > ActionController::RoutingError (No route matches "/items/28/price"): >> Firs

[Rails] Kill jquery remote form submit

2011-02-22 Thread Garrett Lancaster
I am remotely submitting a form potentially several times in close succession. For this particular case, debouncing is not an option. I am looking for the jQuery equivalent of |.abort()| for remote forms submitted using

Re: [Rails] undefined method current_user issue

2011-02-22 Thread Phil Crissman
On Tue, Feb 22, 2011 at 1:18 PM, John Merlino wrote: > Hey all, > > I have this in my plugins directory: > > 1: <% if current_user && current_user.admin? %> > 2: > 3: > 4: <%= link_to 'New Blog Post', > new_blog_post_path %> > > As you can see,it references current_user > > So I def

Re: [Rails] tag helper

2011-02-22 Thread Hassan Schroeder
On Tue, Feb 22, 2011 at 3:31 PM, Mlle wrote: > How can I add specific content inside a tag when I create it using the > tag helper?  Is there an "inner_html" option? Per the doc `tag` generates an *empty* tag -- which by definition can't have content "inside" it. However, `content_tag` can :-)

[Rails] Re: tag helper

2011-02-22 Thread Mlle
I want it to output this, for example and all the stuff will be passed to the tag helper as inner html: On Feb 22, 6:31 pm, Mlle wrote: > How can I add specific content inside a tag when I create it using the > tag helper?  Is there an "inner_html" option? > This doesn't seem to be working.

[Rails] tag helper

2011-02-22 Thread Mlle
How can I add specific content inside a tag when I create it using the tag helper? Is there an "inner_html" option? This doesn't seem to be working. <%= tag(:map, :id => (@module.css_id), :inner_html =>'innerhtml' ) %> -- You received this message because you are subscribed to the Google Groups

[Rails] Re: why accessor method not firing?

2011-02-22 Thread Frederick Cheung
On Feb 22, 9:36 pm, rixter wrote: > I am following an example for how to upload a file from the great book Agile > Web Development with Rails (p 541-543, to be exact); however, instead of an > image file, I need to upload a csv file containing data that will get parsed > and stored in the databa

[Rails] Re: Calling render from a module

2011-02-22 Thread Frederick Cheung
On Feb 22, 9:52 pm, Jeremy Woertink wrote: > Frederick Cheung wrote in post #983169: > > > On Feb 21, 3:39am, Jeremy Woertink wrote: > >> Same thing happens if I call the full path to that partial. > > rspec should realise that the code under test is a helper is the spec > > is in spec/helpers

[Rails] Forcing an insert instead of an update

2011-02-22 Thread James Byrne
I have a has_many association that I wish to append records to. However, what happens instead is that the first row inserted gets updated in place thereafter. The way I am creating this append row is this: current_log_entry = current_entry.ca_customs_edi_log_entries.build This is then saved when

[Rails] Re: Calling render from a module

2011-02-22 Thread Jeremy Woertink
Frederick Cheung wrote in post #983169: > On Feb 21, 3:39am, Jeremy Woertink wrote: >> Same thing happens if I call the full path to that partial. > rspec should realise that the code under test is a helper is the spec > is in spec/helpers (and so should add the required stuff to the test > enviro

[Rails] Re: collections of components

2011-02-22 Thread Vogon Primo
Frederick Cheung wrote in post #983171: > On Feb 22, 4:23pm, Vogon Primo wrote: >> Has ActiveRecord a macro style method for mapping collections of value >> objects? something like composed_of (used for one value object) but for >> a collection of value object. >> >> A second question: >> >> Does

Re: [Rails] Re: Re: Trouble using associations with to_param

2011-02-22 Thread Colin Law
On 22 February 2011 21:23, James Byrne wrote: > Colin Law wrote in post #983199: > >> >> Perhaps you need :foreign_key here also. >> >> Colin > > I will try this if I ever go back to that idiom.  Based on your > suggestion I discover that this parameter is required only for the > belongs_to method

[Rails] why accessor method not firing?

2011-02-22 Thread rixter
I am following an example for how to upload a file from the great book Agile Web Development with Rails (p 541-543, to be exact); however, instead of an image file, I need to upload a csv file containing data that will get parsed and stored in the database. I believe I am following the example

[Rails] Re: Re: Trouble using associations with to_param

2011-02-22 Thread James Byrne
Colin Law wrote in post #983199: > > Perhaps you need :foreign_key here also. > > Colin I will try this if I ever go back to that idiom. Based on your suggestion I discover that this parameter is required only for the belongs_to method. The API documentation does not give an explicit example

[Rails] Re: Dealing with money

2011-02-22 Thread Robert Walker
Ants Pants wrote in post #983192: > The formatting of the amounts will be ###,###.## (it doesn't have to be > locale specific). I also wanted to have a breakdown of the different > currencies that go towards making the total > >55.00 GBP > 175.00 USD > 3000.00 CAN > >

Re: [Rails] Re: Trouble using associations with to_param

2011-02-22 Thread Colin Law
On 22 February 2011 18:34, James Byrne wrote: > James Byrne wrote in post #983156: >> When I do this I obtain nil: >> >> current_shipment = current_entry.shipment >> > .  .  . >> >> Clearly I am missing something or other in the association method call >> but I cannot seem to find what that someth

Re: [Rails] Re: Beginner Help - Iterating and Displaying From Models with Relationship

2011-02-22 Thread Michael Pavling
On 22 February 2011 16:52, Bryan Crossland wrote: > Hi Ryan, Hiya, Can you not top-post, please. It makes it hard to know what you're exactly replying to. TIA. >There are two ways to get it to display what you want. Remove the > = and change your block to read { |app| puts app.name } or do as T

[Rails] Dealing with money

2011-02-22 Thread Ants Pants
Hello all, I've had a look at the Money gem and some others but I think they may be overkill for what I want. Some advice would be nice. I have a site where people pledge some money to an account. The amounts could come from all over the world and I want the user to be able to mark the currency t

Re: [Rails] Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread Hassan Schroeder
On Tue, Feb 22, 2011 at 11:58 AM, korssane korssane wrote: >  i am trying to run script/server but getting the following error : > *** > Booting WEBrick... > /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in > `gem_original_require': no such file to load -- gettext/rails > (Missin

[Rails] Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread korssane korssane
hey guys , i am trying to run script/server but getting the following error : *** Booting WEBrick... /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- gettext/rails (MissingSourceFile) from /usr/lib/ruby/1.8/rubygems/custom_requi

Re: [Rails] Re: Can't get .js.erb to work ...

2011-02-22 Thread Hassan Schroeder
On Tue, Feb 22, 2011 at 10:51 AM, Niklas Nson wrote: > Yes i also belive that it dosent fire up. If i go to : > http://localhost:3000/javascripts/location_handler.js Oops. That's the problem -- files under public are static, that is, *not* interpreted. You need to put your file somewhere within a

[Rails] undefined method current_user issue

2011-02-22 Thread John Merlino
Hey all, I have this in my plugins directory: 1: <% if current_user && current_user.admin? %> 2: 3: 4: <%= link_to 'New Blog Post', new_blog_post_path %> As you can see,it references current_user So I define current_user in User model as a global variable: cattr_accessor :curren

Re: [Rails] Re: Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread Bryan Crossland
If your application is already locked to Rails 2.1 then you can run any version of Rails above that on the server and it will use the code locked into your application to run it as Rails 2.1. How do you know if it is locked? Look under the vendor folder in your application. If there is a rails fold

[Rails] Re: Can't get .js.erb to work ...

2011-02-22 Thread Niklas Nson
[Hope this wont be a dubbel post] My feeling is also that it dosent fire the ruby part of the script. If i go to http://localhost:3000/javascripts/location_handler.js i get a No route matches "/javascripts/location_handler.js" error. If i go to http://localhost:3000/javascripts/location_handler.j

Re: [Rails] Using route helper returns undefined method

2011-02-22 Thread Bryan Crossland
Is your controller class spelled correctly? You have > class CoController < ApplicationController but are trying to reference a controller called cocore which would be class CocoreController. That may be why you are seeing the error. B. On Mon, Feb 21, 2011 at 7:30 PM, Phil Crissman wrote: > >

Re: [Rails] Re: Beginner Help - Iterating and Displaying From Models with Relationship

2011-02-22 Thread Bryan Crossland
Hi Ryan, Your loop is correct. The issue how erb is interpreting what you are asking it to do. The = is telling erb to spit out the contest of the array Company.find(1).applications.each without running the block it has. There are two ways to get it to display what you want. Remove the = and chang

Re: [Rails] nested attributes with belongs_to

2011-02-22 Thread Bryan Crossland
Butu, You should look at before_create in ActiveRecord. I think it would be better if you put on in your Song Model that calls private function to check whether the passed in Movie name exists or not. If it doesn't, create it and if it does exist do nothing. Thanks, B. On Mon, Feb 21, 2011 at 9

[Rails] Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread korssane korssane
Bryan Crossland wrote in post #983170: > Hassan is correct. After getting it to run locally as 2.1 you're going > to want to move the site from Rails 2.1 to 2.2.2 then to 2.3.8 and > then finally 3.* There are going to be a lot of deprecations along the > way that you will need to fix in order to m

Re: [Rails] Re: Ruby Script to accept Spanish characters

2011-02-22 Thread Bryan Crossland
Hi Zahid, Make sure your database.yml file knows to talk to the database in UTF-8. Add the following to you database defined in there: encoding: utf8 That will ensure that the communication is in UTF-8. Now, Fredrick makes a good point. The input file you are reading from should also be in UTF-8

[Rails] Re: Can't get .js.erb to work ...

2011-02-22 Thread Niklas Nson
Yes i also belive that it dosent fire up. If i go to : http://localhost:3000/javascripts/location_handler.js i get a - No route matches "/javascripts/location_handler.js" - error if i go to http://localhost:3000/javascripts/location_handler.js.erb i see the complete source --- function countrySele

Re: [Rails] Re: Re: Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread Bryan Crossland
Ok. The last time I checked this application was locked to Rails 2.1. https://github.com/insoshi/insoshi Copy the rails folder from this application's vendor folder to your's and that should lock yours to version 2.1. Let us know how it goes. B. On Tue, Feb 22, 2011 at 12:24 PM, korssane korssa

Re: [Rails] Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread Bryan Crossland
Hassan is correct. After getting it to run locally as 2.1 you're going to want to move the site from Rails 2.1 to 2.2.2 then to 2.3.8 and then finally 3.* There are going to be a lot of deprecations along the way that you will need to fix in order to make the process of moving to the next version e

Re: [Rails] Multiple Strings for one string to translate?

2011-02-22 Thread Bryan Crossland
This should fit what you want. greetings = ["Hello", "G'day", "Hey", "Hi"] puts greetings[rand(greetings.length)] Thanks, B. On Tue, Feb 22, 2011 at 10:09 AM, Heinz Strunk wrote: > Hey, > > is it somehow possible to translate one string e.g. t('hello') to a > random item of a number of string

Re: [Rails] Save images

2011-02-22 Thread Bryan Crossland
Given the size of files I would store them on the server or on another server like Amazon S3 storage. B. On Tue, Feb 22, 2011 at 7:35 AM, Chris Kottom wrote: > Your instincts on this one are generally correct.  There are some use cases > where storing images in the DB would be useful (e.g. acce

[Rails] Re: collections of components

2011-02-22 Thread Frederick Cheung
On Feb 22, 4:23 pm, Vogon Primo wrote: > Has ActiveRecord a macro style method for mapping collections of value > objects? something like composed_of (used for one value object) but for > a collection of value object. > > A second question: > > Does ActiveRecord use .eql? to check instances for

[Rails] Re: Calling render from a module

2011-02-22 Thread Frederick Cheung
On Feb 21, 3:39 am, Jeremy Woertink wrote: > Ok, so, I'm trying to write my first gem to learn how it all works. > Basically the gem would just be an extra view helper, so I want any > methods in my module to be accessible in a rails app view. > > I want my method to call render, and render a pa

[Rails] Re: Trouble using associations with to_param

2011-02-22 Thread James Byrne
James Byrne wrote in post #983156: > When I do this I obtain nil: > > current_shipment = current_entry.shipment > . . . > > Clearly I am missing something or other in the association method call > but I cannot seem to find what that something is. > > Does anyone here see what I am doing wrong? W

[Rails] Re: Re: Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread korssane korssane
Bryan Crossland wrote in post #983161: > If your application is already locked to Rails 2.1 then you can run > any version of Rails above that on the server and it will use the code > locked into your application to run it as Rails 2.1. How do you know > if it is locked? Look under the vendor folde

Re: [Rails] no gitignore file in app after the "rails new app" command

2011-02-22 Thread Colin Law
On 22 February 2011 18:00, Eyal F. wrote: > Hi, > > Im following this tutorial, > > http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#table:rails_directory_structure > > but when trying to get pass 1.3.1 part im having trouble figuring out > why I can't see the gitignore file in my rails d

[Rails] no gitignore file in app after the "rails new app" command

2011-02-22 Thread Eyal F.
Hi, Im following this tutorial, http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#table:rails_directory_structure but when trying to get pass 1.3.1 part im having trouble figuring out why I can't see the gitignore file in my rails directory. this what happens when I entered "gem list".

[Rails] Re: Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread korssane korssane
thanks Hassane, 1 - iam already using Virtual box..lol -- 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-talk@googlegroups.com. To unsubscribe fr

[Rails] Re: Using route helper returns undefined method

2011-02-22 Thread John Merlino
> Check rake routes. Is the route there? Yeah, I had to use: cocoreim_cocore_index_path -- 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-talk@goo

[Rails] Trouble using associations with to_param

2011-02-22 Thread James Byrne
When I do this I obtain nil: current_shipment = current_entry.shipment The models look like this: class CaCustomsShipment < ActiveRecord::Base has_one :ca_customs_entry has_one :entry, :class_name => 'CaCustomsEntry' #short form def to_param shipment_identifier end class

Re: [Rails] Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread Hassan Schroeder
On Tue, Feb 22, 2011 at 8:28 AM, korssane korssane wrote: > 1- how can i cleaup every thing and start from zero . > i have check the production environment and got the follwing : Your best bet is to use either rvm or some virtualization technology like VirtualBox or VMWare to create a "sandbox"

[Rails] Re: Calling render from a module

2011-02-22 Thread Jeremy Woertink
I took a look at how the Devise gem is doing it, but I don't see that they are actually calling the partial out. I'm assuming the views are just for the generator in that instance. I thought about just writing the HTML inside the method, but that feels hackish to me, plus, I would like to deter

[Rails] collections of components

2011-02-22 Thread Vogon Primo
Has ActiveRecord a macro style method for mapping collections of value objects? something like composed_of (used for one value object) but for a collection of value object. A second question: Does ActiveRecord use .eql? to check instances for modifications? Thank you ___Vogon -- Posted via ht

[Rails] Re: Re: Upgraded to rails 3 and now I can't install plugins

2011-02-22 Thread Clem Rock
Yup - problem solved!!Now I'm feeling pretty stupid. Thanks for your help. Frederick Cheung wrote in post #983062: > On 22 Feb 2011, at 06:07, Clem Rock wrote: > >> >> bash: line 31: git: command not found >> > Sounds like you don't have git installed (or at least not in your > $PATH), whi

[Rails] Re: Re: What version of Rail, Ruby & my website is using?

2011-02-22 Thread korssane korssane
Hassan Schroeder wrote in post #983024: > On Mon, Feb 21, 2011 at 5:35 PM, korssane korssane > wrote: > >> i figure out that the website is running using the following : >> rails : 2.1.0 >> ruby 1.8.6 >> >> what i have to do in this case.. >> >> Update to rails 3 and try to run the website locally

Re: [Rails] two parameters on the /index action

2011-02-22 Thread Paul
Whoops -- it was a matter of constructing the url. curl was interpreting the ampersand as a command divider, so this worked: curl 'http://localhost:3000/documents/?first=one&second=two' Sorry. On Tue, Feb 22, 2011 at 11:05 AM, Paul wrote: > I am sending the URL like this: > > curl http://localh

Re: [Rails] two parameters on the /index action

2011-02-22 Thread Paul
I am sending the URL like this: curl http://localhost:3000/documents/?first=one&second=two So it is not a matter of constructing the URL. I put the :collection parameter in my route file and now the log reports: Started GET "/documents/?first=one" for etc... Processing by DocumentsController#

[Rails] Multiple Strings for one string to translate?

2011-02-22 Thread Heinz Strunk
Hey, is it somehow possible to translate one string e.g. t('hello') to a random item of a number of strings? Example for language files (I know, wrong syntax): en: hello: Hello, G'day, Hey, Hi So every time t('hello') is rendered on of the strings is randomly given out? Like: >> puts t('hello

Re: [Rails] Re: Can't get .js.erb to work ...

2011-02-22 Thread Hassan Schroeder
On Tue, Feb 22, 2011 at 12:05 AM, Niklas Nson wrote: > That gives me the error (in firebug) > > illegal XML character > [Stop on error] var states = <%= @states.collect {|st...ountry_id, > h(state.name)]}.to_json %> If that's what the client is seeing, it would seem to indicate that your *.js.erb

[Rails] Re: omniauth, facebook on ruby 1.9.2 and rails 3.0.0

2011-02-22 Thread Robert Walker
Eugen Ciur wrote in post #982896: > I try to use omniauth to authenticate with facebook account, as in Ryan > Bates tutorial http://railscasts.com/episodes/235-omniauth-part-1. > I have followed all steps in that tutorial. > When point my browser to http://localhost:3000/auth/facebook it indeed > r

[Rails] Re: self.prepend_view_path - am I missing something

2011-02-22 Thread Owain
> >   def set_view_paths > >     self.prepend_view_path "app/views/#{controller_name}/ > > #...@domain.policy.policy_type}" > >   end > Above worked in development but not in testing unless you provide an absolute path for integration testing. def set_view_paths self.prepend_view_path ["#{

Re: [Rails] Re: Can't get .js.erb to work ...

2011-02-22 Thread Jim Ruther Nill
On Tue, Feb 22, 2011 at 4:05 PM, Niklas Nson wrote: > That gives me the error (in firebug) > > illegal XML character > [Stop on error] var states = <%= @states.collect {|st...ountry_id, > h(state.name)]}.to_json %> > > what's the generated js code by that template? is it a valid js array? > On

Re: [Rails] Save images

2011-02-22 Thread Chris Kottom
Your instincts on this one are generally correct. There are some use cases where storing images in the DB would be useful (e.g. access restriction, manipulation at the time of the request), but for 98% of all applications, storing images in public/images will reduce the load on the database and yo

[Rails] Save images

2011-02-22 Thread Bhasker Harihara
Hi All, I want to give each of my user some 20k of space to load their images or pic. for their avatar. These images will not be sent over the internet. So is it good to store it in db (I am using mysql) or just in images directory. Uploading is not a problem as it will be done as a one time jo

Re: [Rails] No. of controllers

2011-02-22 Thread Jatin kumar
A simple advice, go through Rails Guides and Railscasts, even if they don't make sense right now. It will help you a lot. Trust me :) On Tue, Feb 22, 2011 at 1:43 PM, Bhasker Harihara < harihara.bhas...@gmail.com> wrote: > Thank you Fred. > > > On Tue, Feb 22, 2011 at 1:29 PM, Frederick Cheung <

[Rails] Re: self.prepend_view_path - am I missing something

2011-02-22 Thread Owain
On Feb 21, 6:58 pm, Owain wrote: > I have an app that varies its content based upon the domain from which > it is being accessed.  Some of the domain characteristics are > supported in the model but it is easier varying static text in the > views and then sharing the form templates via partials

[Rails] Re: Factory Girl, Spork and Cucumber - duplicate model classes

2011-02-22 Thread Jeff Bigler
I'm experiencing the exact same problem Adam. I haven't been able to figure out what is causing it either... -- 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-talk@googlegroups.com. To unsubs

Re: [Rails] Problem installing restfull authentication

2011-02-22 Thread Imran Latif
Hi, I have installed it in the following way and it works for me:- *git clone git://github.com/technoweenie/restful-authentication.git* * * But before doing this you have to install *"git"* by typing the following command:- *sudo apt-get install git-core* * * Yeah, Collin is right, authlogic i

Re: [Rails] two parameters on the /index action

2011-02-22 Thread Imran Latif
Please! also try to add the following line in your "*routes.rb*" *resources :documents, :collection => {:index => :get}* I hope this will solve your problem. Thanks... On 22 February 2011 13:58, Hendra Gunawan wrote: > Try this > > documents_path(:first => 'one', :second => 'two') > > > O

[Rails] Arel: misunderstanding with intersections

2011-02-22 Thread Karmeliet
Hi, I've been playing with Arel for a few days, but I feel really confused about predicates / arrays intersection. Let's say I have 3 models: users, (bank) accounts and transfers. An account belongs to a user, and a transfer is made of a source and target accounts (see the snippets below). Given

[Rails] acts_as_versioned and activerecord-diff problem

2011-02-22 Thread Lukáš Lipavský
Hi, I'm trying to use acts_as_versioned together with activerecord-diff plugin. I have a Testcase model which is versioned. class Testcase < ActiveRecord::Base acts_as_versioned include ActiveRecord::Diff diff :exclude => [:updated_at, :version, :id] ... end In my view, I'd like to sho

Re: [Rails] Problem installing restfull authentication

2011-02-22 Thread Colin Law
On 22 February 2011 04:44, Mitin Rai wrote: > hi > trying to use restfull authentication, but getting the folloing error Most consider that authlogic is the one to go for rather than restful authentication, or Devise if you want more sophisticated features. Colin > >  script/plugin install > ht

Re: [Rails] autotest with Growl not working

2011-02-22 Thread Colin Law
On 21 February 2011 23:38, Murph2m wrote: > Hi I'm new and using Ruby on Rails 3 but when I run $ autotest nothing > happens (I have growl installed). If I run $ rspec spec then I get the > 'Finished in 0.07253 seconds seconds 2 example, 0 failures' message > > I have the following gems installed

Re: [Rails] Re: Cache data set on the server

2011-02-22 Thread Chris Kottom
Regarding the daemon part of your application, I've done something similar before, and used a combination of Rails-based rake tasks triggered by Chronic or something similar. I didn't have the need to manage the cache as you're describing, but including a task that refreshes cached information and

[Rails] Re: Cache data set on the server

2011-02-22 Thread Frederick Cheung
On Feb 22, 9:33 am, Ram Kumar wrote: > Hi, > > I am new to Rails and I am building a rails server which acts as the > backend for a mobile app. I have certain daemon processes that fetch and > store data in a database. Every time someone makes a request for data > from the phone, I will have to

[Rails] Cache data set on the server

2011-02-22 Thread Ram Kumar
Hi, I am new to Rails and I am building a rails server which acts as the backend for a mobile app. I have certain daemon processes that fetch and store data in a database. Every time someone makes a request for data from the phone, I will have to send him the same dataset irrespective of who is re

[Rails] Re: Ruby Script to accept Spanish characters

2011-02-22 Thread Frederick Cheung
On Feb 22, 9:30 am, Zahid Karnekar wrote: > Hi All, > > I have a ruby script which picks up data from a text file and then adds > the corresponding data into my postgresql database. However, it not > picking up "diacritic" i.e. characters like "Á, é, ó" etc and throwing > the following error. >

[Rails] Ruby Script to accept Spanish characters

2011-02-22 Thread Zahid Karnekar
Hi All, I have a ruby script which picks up data from a text file and then adds the corresponding data into my postgresql database. However, it not picking up "diacritic" i.e. characters like "Á, é, ó" etc and throwing the following error. RuntimeError: ERROR C22021 Minvalid byte sequence fo

Re: [Rails] Is this a bug in ActiveRecord or expected to work this way ??

2011-02-22 Thread Bhasker Harihara
I did not see the other links in the main link. I have changed already. But I wanted the link to avoid such mistakes in the future. Thanks & Regards, On Tue, Feb 22, 2011 at 1:54 PM, Michael Pavling wrote: > On 22 February 2011 06:57, Bhasker Harihara > wrote: > > Is it not accessing the mod

Re: [Rails] two parameters on the /index action

2011-02-22 Thread Hendra Gunawan
Try this documents_path(:first => 'one', :second => 'two') On Tue, Feb 22, 2011 at 6:15 AM, paul wrote: > I've got the following RESTful route: > > resources :documents > > I need to call the index action with two extra parameters, so my url > will look like: > > /documents/?first=one&secon

[Rails] Re: Beginner Help - Iterating and Displaying From Models with Relationship

2011-02-22 Thread Clint
I am not at my computer, so I can't help out with code. Basically you need to dig one layer deeper. The above is an array of Applications. Try to <%=raise Company.find(1).inspect %> to display the returned value/array. From there you can play around till it satisfy your needs. On Feb 22, 4:40 am,

Re: [Rails] Is this a bug in ActiveRecord or expected to work this way ??

2011-02-22 Thread Michael Pavling
On 22 February 2011 06:57, Bhasker Harihara wrote: > Is it not accessing the model at the time of > > $rake db:migrate. Not unless you've written some code in the migration to do so. > Is there anything like a cheat sheet for rails ? There certainly are things like cheatsheets for Rails. I gave

Re: [Rails] No. of controllers

2011-02-22 Thread Bhasker Harihara
Thank you Fred. On Tue, Feb 22, 2011 at 1:29 PM, Frederick Cheung < frederick.che...@gmail.com> wrote: > > > On 22 Feb 2011, at 04:57, Bhasker Harihara > wrote: > > Hi All, > > In rails 3.0.4 > > Is there any limit on the number of controllers that an application can > have ? > > No hard limit >

Re: [Rails] authlogic problem

2011-02-22 Thread Frederick Cheung
On 21 Feb 2011, at 16:00, Kelly Pfaff wrote: > I can't get authlogic to work. > (https://github.com/binarylogic/authlogic) > > i've installed it, > i've put the following in environment.rb: > config.gem "authlogic" > If my memory is correct, rails 2.0.2 predates the existence of config.gem

[Rails] Re: Can't get .js.erb to work ...

2011-02-22 Thread Niklas Nson
That gives me the error (in firebug) illegal XML character [Stop on error] var states = <%= @states.collect {|st...ountry_id, h(state.name)]}.to_json %> On 22 Feb, 08:22, Jim Ruther Nill wrote: > On Tue, Feb 22, 2011 at 2:53 PM, Niklas Nson wrote: > > Trying to follow railscast #88, i know the

Re: [Rails] No. of controllers

2011-02-22 Thread Frederick Cheung
On 22 Feb 2011, at 04:57, Bhasker Harihara wrote: > Hi All, > > In rails 3.0.4 > > Is there any limit on the number of controllers that an application can have ? > No hard limit > Can contollers work across sub-domain ? > Yes. > Can we generate a view dynamically using module helper or so