Re: [Rails] The point of HAML

2011-03-25 Thread Chris Kottom
For me, it's because writing markup intended for human beings in a programmatic style doesn't give me any visual clues as to how it's going to look. The whitespace is a convenient but only inciental way of achieving that. Builder is totally fine when I'm outputting formatted data like XML

Re: [Rails] upgrading from Rails 2.1.0 to 3.0 the right way makes my head hurt

2011-03-25 Thread Chris Kottom
RVM gemsets will help you manage multiple versions of Rails on a single system, but the real problem you have is managing the risk that something in your app will be broken by the upgrade. If you've got reasonable test coverage on your application, you'll probably be able to shortcut the process

[Rails] Edit With Nested Forms - Values Not Preserved Across Submit

2011-03-25 Thread MaggotChild
When a nested form submitted to the create action contains missing data, the form is redisplayed and the nested values the user entered remain. When submitting the same nested form to the update action, the newly entered values remain for the parent record, but the child records revert back to

[Rails] Re: The point of HAML

2011-03-25 Thread Frederick Cheung
On Mar 25, 3:01 am, Alex Goldsmith li...@ruby-forum.com wrote: I get what HAML's about, and that it's better than ERB, but why not go with something completely Ruby along the lines of XML Builder? markaby does that, and there are people who love that too. Each to their own! Fred Then you

[Rails] Re: differences in default unit tests between Rails versions

2011-03-25 Thread Frederick Cheung
On Mar 25, 3:07 am, sol.manager sol.mana...@gmail.com wrote: So, two questions. When I compare the two I see differences in the structure. Our current 2.1.0 site test had the following: require File.dirname(__FILE__) + '/../test_helper' class JobPostTest Test::Unit::TestCase   fixtures

Re: [Rails] Ruby on Rails developer

2011-03-25 Thread Imran ahmed
Yes On Fri, Mar 25, 2011 at 5:00 AM, Me chabg...@gmail.com wrote: Is this normal US working hours? -- Many Thanks Regards Imran Ahmed -- 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

[Rails] Re: A help for installing rails on windows

2011-03-25 Thread salim mandrekar
run this command *gem i mysql2* * * *in command prompt and den check* -- 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 from this group, send email to

Re: [Rails] Re-generate views

2011-03-25 Thread Colin Law
On 24 March 2011 14:53, Linus Pettersson linus.petters...@gmail.com wrote: Hi! When I started my project I generated some scaffolding for my frontend. Now I want to generate some standard scaffolding again, in my /admin area. If I simply do rails generate scaffold admin/posts I get a

[Rails] How to send request client to server using ruby on rails

2011-03-25 Thread Pranoti Patil
Hello I have 2 application one as a client another as a server i want to send a request client application to server application how can i do it using ruby on rails plz reply me as a soon as possible. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are

Re: [Rails] differences in default unit tests between Rails versions

2011-03-25 Thread Colin Law
On 25 March 2011 03:07, sol.manager sol.mana...@gmail.com wrote: In my efforts to upgrade our site from 2.1.0 to 3.0.x, I have upgraded to 2.2.2 and the site works, but I am working on understanding tests, fixtures and the whole deal. If your app does not already have decent tests, so you are

Re: [Rails] How to send request client to server using ruby on rails

2011-03-25 Thread Chris Kottom
Please provide (a lot) more information about the two applications if you want to get constructive answers. On Fri, Mar 25, 2011 at 9:30 AM, Pranoti Patil li...@ruby-forum.com wrote: Hello I have 2 application one as a client another as a server i want to send a request client application to

[Rails] Re: A help for installing rails on windows

2011-03-25 Thread salim mandrekar
*follow this procedure:-* *STEP 1:- INSTALL RUBY 1.9.2* *STEP 2:- INSTALL RUBY GEMS* *STEP 3:- OPEN COMMAND PROMPT TYPE * * gem install rails --include-dependencies* *STEP 4:- gem i dbi* * gem i devise* * gem i globalize* *STEP 5:- gem i mysql2* *if still

Re: [Rails] Re: A help for installing rails on windows

2011-03-25 Thread Michael Pavling
On 25 March 2011 09:23, salim mandrekar mandrekar.sa...@gmail.com wrote: if still same problem arises mail me on mandrekar.sa...@gmail.com no - please keep it on list so the next time someone has this problem, they can search and find the answer/ -- You received this message because you are

[Rails] how to solve ActiveRecord::ConnectionNotEstablished

2011-03-25 Thread salim mandrekar
*im using mysql as a database* * * *im getting the error which says that * ActiveRecord::ConnectionNotEstablished in GreetingsController#index ActiveRecord::ConnectionNotEstablished Rails.root: C:/railsdev/hello Application Trace http://localhost:3000/# | Framework

Re: [Rails] Re: A help for installing rails on windows

2011-03-25 Thread salim mandrekar
dear rahul i was also having the same problem while installing the ruby on rails and using Netbeans. but now its solved.. i'll suggest u please follow the above mentioned steps and den install Netbeans.. -- You received this message because you are subscribed to the Google Groups Ruby on

[Rails] generate models/controllers/migrations/scaffold within an existing plugin

2011-03-25 Thread heithem nouira
Hi, i have newly discovered Rails , and currently trying to write a plugin. the problem is that i couldn't find any generators script (like script/ generate or rails generate) to add models or migrations. i want to add them smoothly like in the standard application. i need your help. thanks in

[Rails] Re: upgrading from Rails 2.1.0 to 3.0 the right way makes my head hurt

2011-03-25 Thread Matt Jones
On Mar 24, 5:48 pm, sol.manager sol.mana...@gmail.com wrote: We have an app that is at Rails 2.1.0 and our web developer has let us know going to 3.0 will cost some money. I have embarked on a personal project to see what is involved in getting from 2.1.0 to 3.0. I have the app up and

[Rails] generators for Rails plugin

2011-03-25 Thread heithem nouira
Hi, i have newly discovered Rails and currently trying to write a plugin from scratch. I want to know how the generation of ressources(scaffold , models,...) within a plugin could be. this thing goes smoothly in Rails standard application because there's script/generate or rails generate. But in

[Rails] undefined method `init' for Mysql:Class on Mac with rvm and Passenger 3

2011-03-25 Thread rtacconi
I tried to find some help in the Passenger group without luck. I would not like to use mysql2 gem (it gives an error too) because in production I have to use mysql gem anyway. I moved to Passenger 3 and I am not able to run a Rails 2 and a 3 apps. They both uses Passenger 3 (latest) and ree

[Rails] Re: Another noob question

2011-03-25 Thread Peter
On Mar 24, 3:23 pm, Linus Pettersson linus.petters...@gmail.com wrote: Now I want to create a list of, say, the 30 latest songs added to my site. I'm trying to be restful and not add new actions, so how do I achieve this? It is a index action but with some extra filters like ...limit(30) and

[Rails] Re: undefined method `init' for Mysql:Class on Mac with rvm and Passenger 3

2011-03-25 Thread Frederick Cheung
On Mar 25, 12:10 pm, rtacconi rtacc...@gmail.com wrote: I tried to find some help in the Passenger group without luck. I would not like to use mysql2 gem (it gives an error too) because in production I have to use mysql gem anyway. I moved to Passenger 3 and I am not able to run a Rails 2

[Rails] [JOBS] Help build some product in London

2011-03-25 Thread Nick Marsh
We have a three month contract (maybe longer) for an amazing Ruby dev to come and help us build some prototype/proof of concept products at our studio in London. We've been given money by the UK Technology Strategy Board to create three proof of concept public services. That means no clients or

Re: [Rails] [JOBS] Help build some product in London

2011-03-25 Thread Andre Joseph Cubeta
I'm intrested, send me email at ajcub...@gmail.com for more detials Thanks! Andre On Mar 25, 2011, at 10:43 PM, Nick Marsh choosen...@gmail.com wrote: We have a three month contract (maybe longer) for an amazing Ruby dev to come and help us build some prototype/proof of concept products at

[Rails] Re: how to solve ActiveRecord::ConnectionNotEstablished

2011-03-25 Thread Me
Is your database.yml file set up? You have created the DB and ran migrations? -- 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 from this group, send

Re: [Rails] Re: upgrading from Rails 2.1.0 to 3.0 the right way makes my head hurt

2011-03-25 Thread Paul
I don't know if this is feasable in your case, but I'd be tempted to start a brand new project in Rails 3, try to get the Gemfile correct and work out problems there, generate scaffolding for all your controllers, etc, from scratch, then use a diff tool to move your existing code into the new

Re: [Rails] Re: upgrading from Rails 2.1.0 to 3.0 the right way makes my head hurt

2011-03-25 Thread Andre Joseph Cubeta
+1 on this, me too, i thought I can upgrade easily but it's different so I used RVM. So from 2.3.8 to 3.0.1 rails using RVM Thanks! Andre On Mar 25, 2011, at 11:22 PM, Paul p...@nines.org wrote: I don't know if this is feasable in your case, but I'd be tempted to start a brand new project

[Rails] Dynamic constants

2011-03-25 Thread PsiPro
I'm looking to define dynamic classes, and in order to get them to play nicely with Rails I need them to behaving like a constantly defiend class. foo = Class.new Won't work AFAIK because foo.class == Class If the new class is defined to a constant however it will work. Foo = Class.new So

[Rails] Re: Dynamic constants

2011-03-25 Thread Frederick Cheung
On Mar 25, 3:44 pm, PsiPro arjes...@gmail.com wrote: I'm looking to define dynamic classes, and in order to get them to play nicely with Rails I need them to behaving like a constantly defiend class. foo = Class.new Won't work AFAIK because foo.class == Class Well that should always be

Re: [Rails] Dynamic constants

2011-03-25 Thread Michael Pavling
On 25 March 2011 15:44, PsiPro arjes...@gmail.com wrote: I'm looking to define dynamic classes, and in order to get them to play nicely with Rails I need them to behaving like a constantly defiend class. and then I can define new class as I see fit. However I do not want to use eval if I can

Re: [Rails] Re: upgrading from Rails 2.1.0 to 3.0 the right way makes my head hurt

2011-03-25 Thread Adrian Perez
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/25/2011 11:22 AM, Paul wrote: I don't know if this is feasable in your case, but I'd be tempted to start a brand new project in Rails 3, try to get the Gemfile correct and work out problems there, generate scaffolding for all your

[Rails] shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Alexey M.
Hello, can anyone simply tell me if what i want to do is ok to do with Rails, or will there arise some serious obstacle? If it is ok to do, then i will probably figure out a way ofter some trial and error. Any other suggestion will also be appreciated. I want to share the primary key among

[Rails] Re: Rails 3 + Postgre + incompatible character encodings: ASCII-8BIT and UTF-8

2011-03-25 Thread LuisRuby
Hmmm, I tried but didn't worked. Thanks for reply! On 25 mar, 13:36, Aldo Italo li...@ruby-forum.com wrote: try this on the top of you seed.rb: # -*- coding: utf-8 -*- -- Posted viahttp://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups

Re: [Rails] shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Colin Law
On 25 March 2011 16:01, Alexey M. li...@ruby-forum.com wrote: Hello, can anyone simply tell me if what i want to do is ok to do with Rails, or will there arise some serious obstacle? If it is ok to do, then i will probably figure out a way ofter some trial and error. Any other suggestion will

[Rails] Re: Rails 3 + Postgre + incompatible character encodings: ASCII-8BIT and UTF-8

2011-03-25 Thread Aldo Italo
try this on the top of you seed.rb: # -*- coding: utf-8 -*- -- 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

[Rails] Most idiomatic way to link_to the current page

2011-03-25 Thread Kendall Gifford
Hello all. This is a rails 3 oriented question. I'm creating a simple, application-wide view-helper method in my app/helpers/application_helper.rb that will be called in the context of several different controller/action views. module ApplicationHelper def my_custom_link_to link_to Here

[Rails] Re: wrong constant name user error

2011-03-25 Thread John Merlino
Frederick Cheung wrote in post #988949: On Mar 23, 8:52pm, John Merlino li...@ruby-forum.com wrote: params[:controller].singularize.constantize.responds_to(:viewable) Presumably this is the line throwing the error. If params[:controller] is users then you'll be calling constantize on the

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Alexey M.
Colin, probably my life will be much easier, but much less fun. It is just so natural to use the same primary key in this situation. -- 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

Re: [Rails] Workaround for CVE-2010-3933

2011-03-25 Thread Bryan Crossland
On Thu, Mar 24, 2011 at 1:18 PM, Gabriel Sobrinho gabriel.sobri...@gmail.com wrote: Hi, First look this vulnerability issue: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-3933 My application models: http://pastie.org/1709174 On my departments form, when user selects a health

Re: [Rails] Re: wrong constant name user error

2011-03-25 Thread Colin Law
On 25 March 2011 16:47, John Merlino li...@ruby-forum.com wrote: ... It works but I dont like that I am checking whether a model has the method viewable just to display a link to a detail view in the table. Is there a better way to determine if the current controller's table should contain a

Re: [Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Colin Law
On 25 March 2011 16:47, Alexey M. li...@ruby-forum.com wrote: Colin, probably my life will be much easier, but much less fun. Are you sure? Trying to force rails away from its preferred conventions is rarely fun. Do it the easy way and use the time saved to indulge in something that is really

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Kendall Gifford
It is certainly possible to do what you're describing, and yes, the same person *could* be both an instructor and a member at the same time. However, I'll second Colin's suggestion that you just follow the convention to have a separate id primary key column in both the instructors and members

[Rails] Securtiy around Postgresql Views and Rails Models.

2011-03-25 Thread Tom Tom
Hi, I just read a posting at, http://railsblog.kieser.net/2010/03/working-with-postgres-views-rails.html, which addresses the issue of Posgresql Views and Rails Models and user security. I was thinking of trying to implement some of the suggestions made in this posting but thought I would ask if

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Alexey M.
It is just so natural to use the same primary key in this situation. Why? Well, it seems natural to me, and i often trust my senses :). I have been playing with it in console for a few minutes now and observing some fun and weird behavior: i = Instructor.create i.id# = 1 i.person_id

[Rails] Mysql2::Error: Can't create database 'db_database'

2011-03-25 Thread Rajesh B.
Hi all database yml-- development: adapter: mysql2 database: db_test username: root password: -- i have installed mysql2 and 64bit mysql server. when i run rake db:create it gives me this errror does any one know whats happening here? macbook:test_proj rathod$

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Kendall Gifford
It appears from your console session you never added the #set_primary_key macro method call to you Instructor class. I just duplicated your console session as follows in a test project only *with* the set_primary_key call as follows: i = Instructor.create i.id # = 1 i.person_id # = 1

[Rails] Unknown Route?

2011-03-25 Thread Mohammad E.
Looks prettier @ http://bit.ly/dRaTCm if you want it :) Anyone I'm a bit stumped here. Error: No route matches {:controller=users, :action=confirm, :username=Mohammad, :code=%242a%2410%24%2FN5mhFlnu.VJ.DMdzh3ob.%2FQAbSb82nHZuZDAl%2F27726MKm6kfLbW} Route: get 'users/confirm/:username/:code' =

[Rails] Re: Dynamic constants

2011-03-25 Thread PsiPro
Can you explain the problem you're facing that's lead you to determine that dynamic classes are the solution? It may be that people could suggest alternate solutions that might not depend on the same functionality... I currently have a table-less model that is a SearchModel, it has attributes

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Alexey M.
Kendall, thank's for your suggestion, it really made id and person_id equivalent for instructors and stopped the described above weird (and fun) behavior. Also, p=Person.create m=p.create_member i=p.create_instructor work as expected now with setting identical values for p.id, m.id,

Re: [Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Colin Law
On 25 March 2011 17:15, Alexey M. li...@ruby-forum.com wrote: It is just so natural to use the same primary key in this situation. Why? Well, it seems natural to me, and i often trust my senses :). I have been playing with it in console for a few minutes now and observing some fun and

Re: [Rails] Handling User-Entered Dates with Time Zones

2011-03-25 Thread Frederick Cheung
On 25 Mar 2011, at 04:27, Seth Willits lists@ruby-forum. ...except that doing this, Rails interprets the datetime the user entered in my configured default time zone (UTC). Instead, I need to use the time zone the user specified. So after failing to find any good way to do this, it seems

[Rails] Re: upgrading from Rails 2.1.0 to 3.0 the right way makes my head hurt

2011-03-25 Thread sol.manager
When I change the Rails gem version from 2.2.2 to 2.3.4 and restart the site, I get: Error message: undefined local variable or method `version_requirements' for #Rails::GemDependency:0x102b8d988 Exception class: NameError I did some investigating and realized that on my system I cannot generate

Re: [Rails] Re: wrong constant name user error

2011-03-25 Thread Frederick Cheung
On 25 Mar 2011, at 16:47, John Merlino li...@ruby-forum.com wrote: Frederick Cheung wrote in post #988949: On Mar 23, 8:52pm, John Merlino li...@ruby-forum.com wrote: if params[:controller].singularize.capitalize.constantize.method_defined? :viewable Why not just

[Rails] Re: upgrading from Rails 2.1.0 to 3.0 the right way makes my head hurt

2011-03-25 Thread sol.manager
I have been debating this same thing. There are so many changes that have been made since our site was first built (late 2006) that I almost wonder if starting a clean site from blank, fixing all the gems that need replacing, replacing test with Rspec and then regenerating the models, controllers

Re: [Rails] Mysql2::Error: Can't create database 'db_database'

2011-03-25 Thread Frederick Cheung
On 25 Mar 2011, at 17:24, Rajesh B. li...@ruby-forum.com wrote: Hi all database yml-- development: adapter: mysql2 database: db_test username: root password: -- i have installed mysql2 and 64bit mysql server. when i run rake db:create it gives me this

[Rails] Re: Most idiomatic way to link_to the current page

2011-03-25 Thread Kendall Gifford
Just a follow-up to my own post, another reason I'm looking for an alternative method here (besides being more idiomatic) is to support a version that can add query-string parameters (and a fragment identifier) to the generated url: Example Version 2: module ApplicationHelper def

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Alexey M.
A relevant question that i think is appropriate for this thread: can anybody please explain to me the purpose of primary_key type in context of migrations: t.primary_key :person_id ? The migration class CreateInstructors ActiveRecord::Migration def self.up create_table :instructors do |t|

[Rails] Why is Rails eager loading most of my database?

2011-03-25 Thread Taylor Strait
I have a highly-normalized user model called Respondent. It has many join fields such as ethnicity_id, education_id, etc. that define relational categories. Most of them are indexed. For reasons unknown, Rails is hitting a huge number of the tables when accessing any Respondent objects. For

Re: [Rails] Why is Rails eager loading most of my database?

2011-03-25 Thread Frederick Cheung
On 25 Mar 2011, at 18:34, Taylor Strait li...@ruby-forum.com wrote: I have a highly-normalized user model called Respondent. It has many join fields such as ethnicity_id, education_id, etc. that define relational categories. Most of them are indexed. For reasons unknown, Rails is hitting a

Re: [Rails] Unknown Route?

2011-03-25 Thread Philip Hallstrom
Looks prettier @ http://bit.ly/dRaTCm if you want it :) Anyone I'm a bit stumped here. Error: No route matches {:controller=users, :action=confirm, :username=Mohammad, :code=%242a%2410%24%2FN5mhFlnu.VJ.DMdzh3ob.%2FQAbSb82nHZuZDAl%2F27726MKm6kfLbW} Route: get

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Alexey M.
Just on more related question (if anyone has time to answer): if i have set_primary_key 'person_id': class Instructor ActiveRecord::Base set_primary_key 'person_id' ... end does it mean that writing class Person ActiveRecord::Base has_one :instructor, :primary_key = 'person_id' end

[Rails] has_one/belongs_to relationship failing.

2011-03-25 Thread R. K.
I have an Ingredient which has a Measurement. class Ingredient ActiveRecord::Base has_one :measurement belongs_to :recipe accepts_nested_attributes_for :measurement end class Measurement ActiveRecord::Base belongs_to :ingredient end The schemas appear right: create_table

Re: [Rails] has_one/belongs_to relationship failing.

2011-03-25 Thread Colin Law
On 25 March 2011 20:24, R. K. li...@ruby-forum.com wrote: I have an Ingredient which has a Measurement. class Ingredient ActiveRecord::Base  has_one :measurement  belongs_to :recipe  accepts_nested_attributes_for :measurement end class Measurement ActiveRecord::Base  belongs_to

[Rails] using a paginate method to display the second group of 25 records on page 2

2011-03-25 Thread John Merlino
Hey all, I'm trying to fully understand what this method in Ruby does. Basically it passes a collection of records from the database (using the Rails find method) into the argument list as a local variable called resources. It assigns the local variable to an instance variable called

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Alexey M.
I have deleted one of my questions because i was apparently confused. Anyway, i do not understand the use of :primary_key parameter in has_one option like in has_one :something, :primary_key = 'someone_id' What is it for if the primary key has to be set with set_primary_key = 'someone_id' ?

Re: [Rails] using a paginate method to display the second group of 25 records on page 2

2011-03-25 Thread Colin Law
On 25 March 2011 20:33, John Merlino li...@ruby-forum.com wrote: Hey all, I'm trying to fully understand what this method in Ruby does. Basically it passes a collection of records from the database (using the Rails find method) into the argument list as a local variable called resources. It

[Rails] Re: Why is Rails eager loading most of my database?

2011-03-25 Thread Taylor Strait
Hi Fred, thanks for the reply. Does rails execute validations when simply showing the object? My assumption is that validations were only called before_create. Taylor -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby

[Rails] Re: using a paginate method to display the second group of 25 records on page 2

2011-03-25 Thread Ar Chron
John Merlino wrote in post #989291: ((@all_resources.size - 1) / @limit).to_i + 1 What does the size method do and why add one at the end? Suppose 100 records, with a page size of 30 num_pages = ((100-1)/30) num_pages = 99/30 num_pages = 3.3 num_pages = 3 (to_i) num_pages = 4 3 full pages

[Rails] Re: [JOBS] Help build some product in London

2011-03-25 Thread Ar Chron
Nick Marsh wrote in post #989203: That means no clients or anything Oh but you DO have clients, you just don't know them yet. Involve elements of your projected user base(s) now, and you might find a much higher adoption rate later... -- Posted via http://www.ruby-forum.com/. -- You

Re: [Rails] Re: Why is Rails eager loading most of my database?

2011-03-25 Thread Frederick Cheung
On 25 Mar 2011, at 20:51, Taylor Strait li...@ruby-forum.com wrote: Hi Fred, thanks for the reply. Does rails execute validations when simply showing the object? My assumption is that validations were only called before_create. The validations aren't run, but when you do

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Kendall Gifford
For the situation described in this thread where your Person class's #has_one :instructor refers to another class (and table) that in fact HAS a column named person_id then there is no need to provide the :primary_key option, as this is what it will infer by default. However, in even weirder

[Rails] Re: Why is Rails eager loading most of my database?

2011-03-25 Thread Taylor Strait
Thanks Fred - that was very helpful. Is there a more efficient way to validate inclusion of that doesn't tax the database so heavily? -- 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

[Rails] Re: Why is Rails eager loading most of my database?

2011-03-25 Thread Frederick Cheung
On Mar 25, 9:50 pm, Taylor Strait li...@ruby-forum.com wrote: Thanks Fred - that was very helpful. Is there a more efficient way to validate inclusion of that doesn't tax the database so heavily? Well personally I'd just use a foreign key constraint, but you could use validates presence of

[Rails] Re: Problem in saving fields to database from csv using fastercsv

2011-03-25 Thread Frederick Cheung
On Mar 25, 4:56 am, Surya raj.sury...@gmail.com wrote: Hi Thanks for your kind response, Frederick. I have finally sort it out. It was my csv file which was in UTF-61le format, I made a new file with UITF-8 format and that worked as the way I wanted.      One more thing I wants to ask

[Rails] Re: has_one/belongs_to relationship failing.

2011-03-25 Thread R. K.
Colin Law wrote in post #989292: On 25 March 2011 20:24, R. K. li...@ruby-forum.com wrote: belongs_to :ingredient t.datetime created_at t.string equivalent t.datetime created_at t.datetime updated_at end It is the belongs_to object that should have the foreign key, so measurement

[Rails] Library of freely available Rails-3-ready html/css/png designs?

2011-03-25 Thread Greg C
Hi there, In the past I've purchased website designs from various places, but have always needed to do a fair bit of adaptation to get the designs plugged into my Rails websites. I have been Googling around for, but have yet to find, any repository of community contributed website designs that

[Rails] Re: using a paginate method to display the second group of 25 records on page 2

2011-03-25 Thread John Merlino
Suppose 90 records... ((90-1)/30).to_i + 1 = 3, 3 full pages It's just some math hijinks to make sure any partial page isn't missed in the page count. Thanks that was very helpful. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the

Re: [Rails] generate models/controllers/migrations/scaffold within an existing plugin

2011-03-25 Thread Bryan Crossland
On Fri, Mar 25, 2011 at 3:38 AM, heithem nouira heithem.nou...@gmail.comwrote: Hi, i have newly discovered Rails , and currently trying to write a plugin. the problem is that i couldn't find any generators script (like script/ generate or rails generate) to add models or migrations. i want

Re: [Rails] generators for Rails plugin

2011-03-25 Thread Bryan Crossland
On Fri, Mar 25, 2011 at 6:37 AM, heithem nouira heithem.nou...@gmail.comwrote: Hi, i have newly discovered Rails and currently trying to write a plugin from scratch. I want to know how the generation of ressources(scaffold , models,...) within a plugin could be. this thing goes smoothly in

[Rails] Re: Re: wrong constant name user error

2011-03-25 Thread John Merlino
Frederick Cheung wrote in post #989266: On 25 Mar 2011, at 16:47, John Merlino li...@ruby-forum.com wrote: Frederick Cheung wrote in post #988949: On Mar 23, 8:52pm, John Merlino li...@ruby-forum.com wrote: if params[:controller].singularize.capitalize.constantize.method_defined?

[Rails] Re: upgrading to rails 3.

2011-03-25 Thread Ruby Man
Msan Msan wrote in post #937930: I've installed rails_upgrade plugin with ruby script/plugin install http://github.com/rails/rails_upgrade.git. Then if I run rake rails:upgrade:check it says rake aborted! no such file to load -- initializer What I've missed? I'm having the exact same

[Rails] Re: shared primary key (using the primary key as a foreign key for has_one association)

2011-03-25 Thread Kendall Gifford
To further clarify (and answer one of the questions above): You must specify the :primary_key option to #has_one (and #has_many) in your model definition if, and only if, the table of the resource that owns the other record (i.e., the table associated w/the model that contains the #has_one

[Rails] Conflict between ruby jruby bundle install

2011-03-25 Thread Dan King
When I run the 'bundle install' command from the main directory of my ruby on rails (version 3) app, I get the following error: Installing sqlite3 (1.3.3) with native extensions C:/jruby-1.6.0.RC2/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in `build_extensions': ERROR: Failed to build gem

[Rails] Re: Most idiomatic way to link_to the current page

2011-03-25 Thread Kendall Gifford
Okay, since I've got no response and since the traffic here is high enough that this topic will be effectively buried soon, I'll follow up with my final solution. I decided what would be nice is a universal #link_to_self helper method. The idea is that it otherwise works just like the existing

[Rails] Active support error when loading rails server/console?

2011-03-25 Thread Gaba Luschi
Hi, I cloned a git repo and then loaded up my terminal and typed: rails server. It's worked normally but this time I keep on getting the error: -[31mCould not find activesupport-3.0.5 in any of the sources-[0m anyone know why this is? (can't fire up rails console either) -- Posted via

Re: [Rails] Active support error when loading rails server/console?

2011-03-25 Thread Xavier Noria
On Sat, Mar 26, 2011 at 12:16 AM, Gaba Luschi li...@ruby-forum.com wrote: Hi, I cloned a git repo and then loaded up my terminal and typed: rails server.  It's worked normally but this time I keep on getting the error: -[31mCould not find activesupport-3.0.5 in any of the sources-[0m

[Rails] Re: Edit With Nested Forms - Values Not Preserved Across Submit

2011-03-25 Thread MaggotChild
On Mar 25, 12:07 am, MaggotChild hsomob1...@yahoo.com wrote: Is it possible to retain nested data across form redisplays to the update action? Anyone? The answer appears to be no, given the Rails Guides example and the Complex Forms Examples: github.com/alloy/complex-form-examples/tarball/

[Rails] Re: inconsistent validate_uniqueness_of :scope behavior?

2011-03-25 Thread Gabriel Saravia
It may not be the problem, but I think there is some strangeness there in that you have a model called Setting and an attribute called setting. possibly, Rails is getting confused - is it validating uniqueness of setting the attribute, or is it thinking that there can be only one Setting

[Rails] can't reference module in /lib/foo

2011-03-25 Thread Patrick Clas
I tried creating a module in /lib/my_foo/foo_bar.rb called module MyFoo::FooBar. Inside that module I defined a method getFoo(). I modified application.rb and added the line config.autoload_paths += %W(#{Rails.root}/lib). When I tried to access MyFoo::FooBar.getFoo() in my controller I got the

[Rails] Re: how to solve ActiveRecord::ConnectionNotEstablished

2011-03-25 Thread salim mandrekar
yes. *database.yml* file is ok.. even i can run the *rake db:create* and *rake db:migrate* commands with zero errors.. wat can be the problem? -- 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

Re: [Rails] Re: Problem in saving fields to database from csv using fastercsv

2011-03-25 Thread Surya
Thanks Frederick, I got it :) I did this: FasterCSV.foreach(path_to_csv, :col_sep = ';', :quote_char = ') do |row| Used row here! end And it removed ' from the string. On Sat, Mar 26, 2011 at 3:32 AM, Frederick Cheung frederick.che...@gmail.com wrote: On Mar 25, 4:56 am, Surya