[Rails] Re: how to combine SQL queries in self.up

2009-04-30 Thread Marnen Laibow-Koser
Vipin wrote: [...] > because there is no other way i guess to have a non integer primary > key in Rails framework > --vipin Be careful! Rails *really* wants an integer primary key on most tables. Although it may be possible to do without it, I understand that problems may arise (Fred or other

[Rails] model

2009-04-30 Thread Amita Bhatkhande
Hi, Should every model have an associated table in database? I have a model as a subclass of another model class. I am getting 'MySQL gone away' error while creating a new object of this subclass. Any clues? - Amita. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~--

[Rails] Re: Making a link to a User profile

2009-04-30 Thread Chris Hanks
map.profile is a named route, so it'll give you the route "profile_path" - I'm not 100% sure which would work, but I'd try: profile_path(comment.user) or profile_path(comment.user.screen_name) > You have a nil object when you didn't expect it! > The error occurred while evaluating nil.screen_

[Rails] Redirecting from a View

2009-04-30 Thread doug
I'd sure like to be able to insert a redirect_to within a rescue clause of a view. Anyone have any ideas how I might be able to do that? Thanks for any input. ... doug --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

[Rails] Re: Can't get to an action in a RESTful controller

2009-04-30 Thread Chris Hanks
I'm not familiar with recognize_path, so I can't really speak to that. If you want to add an route to the set that's generated for you by map.resources, see here: http://guides.rails.info/routing.html#adding-more-restful-actions So, in your case, you'd probably edit routes.rb and change your u

[Rails] [ANN] rspec-rails 1.2.6 Released

2009-04-30 Thread David Chelimsky
rspec-rails version 1.2.6 has been released! Behaviour Driven Development for Ruby on Rails. ### Version 1.2.6 / 2009-04-30 * bug fixes * restored rake tasks for rspec[-rails] as plugins * * *

[Rails] [ANN] rspec 1.2.6 Released

2009-04-30 Thread David Chelimsky
rspec version 1.2.6 has been released! Behaviour Driven Development for Ruby. Changes: ### Version 1.2.6 / 2009-04-30 * bug fixes * gem actually built with spec executable * * * * * --~--

[Rails] Can't get to an action in a RESTful controller

2009-04-30 Thread Sj Tib
Folks, I am using the restful_authentication plugin. This creates the users controller which is declared as a resource in routes.rb as below map.resources :users Now in the UsersController I have created an action to resetpwd that I am trying to get to from the login page when the user clicks

[Rails] button_to_remote problem on 2.3.2

2009-04-30 Thread Eddie Ridwan
Sorry about the previous aborted post.. Here is the full post. I have a link_to_remote call that works as expected (using Rails 2.3.2): <%= link_to_remote "-", { :url => { :action => :remove_from_cart, :id => cart_item.product} }, { :href => url_for(:action => :remove_from_cart, :id => cart_item

[Rails] Problem with button_to_remote on 2.3.2

2009-04-30 Thread Eddie Ridwan
I have a link_to_remote call which works as expected: <%= link_to_remote "-", { :url => { :action => :remove_from_cart, :id => cart_item.product} }, { :href => url_for(:action => :remove_from_cart, :id => cart_item.product) } %> -- Posted via http://www.ruby-forum.com/. --~--~-~--~--

[Rails] Re: Cannot get jquery to work

2009-04-30 Thread Anil
The problem was the case of addClass. Changing addclass to addClass did the trick. Thank you very much guys for all your help. -Anil On Apr 30, 11:37 am, pharrington wrote: > yeah, if you still have javascript_include_tag :defaults, prototype > will still get loaded > > If you want to keep pro

[Rails] how to disable auto-increment in primary key.

2009-04-30 Thread Vipin
How can i disable the auto-increment for a primary key data type. The purpose of using primary_key data type is using different name for primary key. But we still want to use all the properties of "id" except for auto increment part. I had my migration as following #=MIGRATION def s

[Rails] Re: Need Ruby on Rails Developer / NY

2009-04-30 Thread pleb...@gmail.com
pls,give me the details. thank you. On May 1, 6:18 am, Shveta wrote: > Hi Folks, > > We need a Ruby on Rails Developer for a position in NY . This would be > a year long project. > > If you feel interested, please get ack to me ASAP at > shv...@prokarma.com > > Thanks, > Shveta > shv...@prokarma

[Rails] Re: how to combine SQL queries in self.up

2009-04-30 Thread Vipin
> AnyArbitraryModel.connection.execute(all_of_your_sql) > but in my case, my whole of the data is static and i want to populate into the table at the time of migration itself. It is going to be like creation of table followed by insertion of 1000s of rows into them. Will it work there too? If p

[Rails] Re: how to combine SQL queries in self.up

2009-04-30 Thread Vipin
> You shouldn't need to, at least in the way you're asking about. Write > your migrations in Ruby, not raw SQL. > because there is no other way i guess to have a non integer primary key in Rails framework --vipin --~--~-~--~~~---~--~~ You received this message be

[Rails] Making a link to a User profile

2009-04-30 Thread Sean Six
So I have a blog like setup for my website. Users can comment on another person's blog. I want the comment to include a link to the author's profile. This is proving to be problematic. The blog is a resource and the comments are also a resource, nested in the blog. The profile route is this: m

[Rails] Re: Automatically delete oldest post of a specified tag

2009-04-30 Thread Victor Vlist
Hello, I'm trying to create that callback method. Here's what I have so far. post model: class Post < ActiveRecord::Base after_create :check_posts_per_tag after_create :destroy_oldest_post_of_tag acts_as_taggable #<-- for acts_as_taggable_on_steroids validates_presence_of :body, :title,

[Rails] Re: Exception notifier and rails 2.3, does it work?

2009-04-30 Thread Andrew Bloom
Very strange. Have you checked postfix at all? I use ExceptionNotifier in 2.3 with no problems at all. On Apr 30, 1:25 pm, fausto wrote: > Hi, i've just installed exception notifier, set in the enviroment.rb > (i've tried also in an inizializer file and in production.rb in the > enviroments fold

[Rails] Re: MacVim and rails.vim not working

2009-04-30 Thread 7stud --
Harold A. Giménez Ch. wrote: > It is misleading, I'll give you that...but for future reference, the > process > you just went through will be very similar with any vim plugin. > > On Thu, Apr 30, 2009 at 6:34 PM, 7stud -- > Excuse me? whoops. > Well, is rails installed (as a gem, not frozen

[Rails] Re: Unable to install RMagick

2009-04-30 Thread Tim Hunter
Lakshmi Kaza wrote: > ++ > | This rmagick gem is for use only on Linux, BSD, OS X, and similar > systems | | that have a gnu or similar toolchain installed. The > rmagick-win32 gem is a | | pre-compiled version of RMagick

[Rails] Dirty objects and overload attribute read/write methods

2009-04-30 Thread Bob B.
Hi, I'm trying to use dirty fields but keep running into trouble with attributes that I've overloaded. It looks like the dirty.rb module uses read_attribute and to figure out the old value. Unfortunately this is before my overloaded methods have done their work. Therefore, the "old" value is n

[Rails] Re: Plese have a look on this error and tell me y it comes

2009-04-30 Thread Matt Jones
I couldn't say for sure, but have you got the ramf gem installed and activated? Or the plugin? OperationProcessorsManager is defined as part of ramf: http://github.com/neerfri/ramf/tree/master --Matt Jones On Apr 30, 12:19 am, Hamid Raza wrote: > Drive\Ruby Projects\ramf>ruby script/generate m

[Rails] Need Ruby on Rails Developer / NY

2009-04-30 Thread Shveta
Hi Folks, We need a Ruby on Rails Developer for a position in NY . This would be a year long project. If you feel interested, please get ack to me ASAP at shv...@prokarma.com Thanks, Shveta shv...@prokarma.com --~--~-~--~~~---~--~~ You received this message beca

[Rails] Trunicating Names in options_from_collection_for_select

2009-04-30 Thread Mario Gr
Anyone know how I could trunicate the names of a passed in array in options_from_collection_for_select? I tried a few things but nothing worked. Any ideas would be appreciated! <%= options_from_collection_for_select available_projects, :id, :name, @selected_project_id %> -- Posted via http://

[Rails] Re: MacVim and rails.vim not working

2009-04-30 Thread Harold A . Giménez Ch .
It is misleading, I'll give you that...but for future reference, the process you just went through will be very similar with any vim plugin. On Thu, Apr 30, 2009 at 6:34 PM, 7stud -- wrote: > > 7stud -- wrote: > > Harold wrote: > >> Should be simple: The "rails" folder should not be present under

[Rails] Re: is possible limit the number of has_many objects?

2009-04-30 Thread Matt Jones
That reminded me of a really funny article: "Gay marriage: the database engineering perspective" http://qntm.org/?gay Amusing, regardless of one's opinion of the issue. --Matt Jones On Apr 30, 9:16 am, Robert Walker wrote: > Colin Law wrote: > > 2009/4/30 Colin Law > > >> Use > >> has_one :w

[Rails] Re: MacVim and rails.vim not working

2009-04-30 Thread 7stud --
7stud -- wrote: > Harold wrote: >> Should be simple: The "rails" folder should not be present under >> your .vim folder. > > Stupid maintainer. > I have a question about that: when you unzip a file isn't there a container directory? When I untar a file, all the files end up in a master dire

[Rails] Re: Polymorphic Associations... confusing. Do I need them?

2009-04-30 Thread Chris Hanks
Hi again - I'm having another problem now. I'm trying to set up a nested model form for the setup above (so on the edit tutorial screen, someone can edit the contents of all the examples and questions at once). In tutorial.rb I've already set up: accepts_nested_attributes_for :sections, :allo

[Rails] Re: MacVim and rails.vim not working

2009-04-30 Thread Harold A . Giménez Ch .
On Thu, Apr 30, 2009 at 6:10 PM, 7stud -- wrote: > > Harold wrote: > > Should be simple: The "rails" folder should not be present under > > your .vim folder. > > Stupid maintainer. Excuse me? > > > > > > > Move the plugin, doc and autoload files individually > > to each of the subfolders of .vi

[Rails] Re: MacVim and rails.vim not working

2009-04-30 Thread 7stud --
Harold wrote: > Should be simple: The "rails" folder should not be present under > your .vim folder. Stupid maintainer. > Move the plugin, doc and autoload files individually > to each of the subfolders of .vim, so that the tree looks like this: > > .vim > | > --autoload > | | > | --ra

[Rails] Re: Unable to install RMagick

2009-04-30 Thread Frederick Cheung
On Apr 30, 8:36 pm, Lakshmi Kaza wrote: > > C:>gem install rmagick -win32 -v 2.9.0 > Building native extensions. This could take a while... ERROR: Error > installing rmagick: ERROR: Failed to build gem native extension. just a guess, but that should probably rmagick-win32 (ie all one word) rat

[Rails] Re: Integrate test process with Rspec and Cucumber in a plugin using Desert

2009-04-30 Thread Harold
Are you require'ing all of the files it can't find inside spec_helper? I've never done anything with Desert, but sounds like the files aren't being required. Some code would help diagnose the issue. On Apr 30, 11:12 am, romain endelin wrote: > Hello, I'm developing some rails plugins with deser

[Rails] Re: how to search all fields for a string in SQL ?

2009-04-30 Thread Harold
I would suggest going with the thinkingsphinx plugin instead of ultrasphinx. Thinkingsphinx's syntax is much cleaner. http://ts.freelancing-gods.com/usage.html http://railscasts.com/episodes/120-thinking-sphinx On the other hand, if your dataset is small enough, you could try scoped-search, whic

[Rails] Re: how to search all fields for a string in SQL ?

2009-04-30 Thread Robert Walker
wbsurf...@yahoo.com wrote: > Using SQL or activerecord I am not sure how to search all fields for a > specific value ? > I know how to do this by just writing ruby code. To do it in SQL or an > activerecord find w/condition, > I don't know how. I actually am supposed to combine an find w/ > condit

[Rails] Re: ActionMailer view template:

2009-04-30 Thread James Byrne
Steve Ross wrote: > You are still getting all the indentation from the iterations that are > skipped (i.e., where the currency is not USD). > > <% for currency in @rates -%> ><% next unless currency[2] == 'USD' -%> ><%= currency[2] %> ... <%= currency[4] %> > <% end -%> > > I

[Rails] Re: problem with nil.user

2009-04-30 Thread E. Litwin
Just to clarify - are you setting session[:user_id] in the user.login! (session) call? The other suggestions on handling a nil session[:user_id] (i.e. using find_by_id) are the appropriate ways to handle the error. Eric On Apr 30, 12:09 pm, Stephen Fagan wrote: > E. Litwin wrote: > > When are y

[Rails] Re: ActionMailer view template:

2009-04-30 Thread s.ross
You are still getting all the indentation from the iterations that are skipped (i.e., where the currency is not USD). <% for currency in @rates -%> <% next unless currency[2] == 'USD' -%> <%= currency[2] %> ... <%= currency[4] %> <% end -%> I'm not sure you need the minus sig

[Rails] how to search all fields for a string in SQL ?

2009-04-30 Thread wbsurf...@yahoo.com
Using SQL or activerecord I am not sure how to search all fields for a specific value ? I know how to do this by just writing ruby code. To do it in SQL or an activerecord find w/condition, I don't know how. I actually am supposed to combine an find w/ condition and a search all fields for a value

[Rails] Re: MacVim and rails.vim not working

2009-04-30 Thread Harold
Should be simple: The "rails" folder should not be present under your .vim folder. Move the plugin, doc and autoload files individually to each of the subfolders of .vim, so that the tree looks like this: .vim | --autoload | | | --rails.vim --doc | | | --rails.txt --plugin | --r

[Rails] Re: ActiveRecord::Base.establish_connection loads once?

2009-04-30 Thread elioncho
Can I make it load in every request? On Apr 30, 1:33 pm, elioncho wrote: > Hello guys, > > I'm using the establish connection method on my models to connect to > different databases. My question is : Is it possible to connect to > various databases dynamically as I'm trying to do (I am sending a

[Rails] Re: how-to introduce a rails patch to the dev community?

2009-04-30 Thread Emanuele Tozzato
LOL! On Thu, Apr 30, 2009 at 11:57 AM, Fernando Perez < rails-mailing-l...@andreas-s.net> wrote: > > > Try getting some interest on freenode#rubyonrails irc. Do not get your > > hopes up though. > To get more attention you can also post pictures of nude women, > preferably during a rails confere

[Rails] Re: RJS not rendering correctly when mime-type is 'iphone'

2009-04-30 Thread Andrew
Yes, I have tried it with the file named something.iphonejs.rjs. On Apr 30, 1:30 pm, Marnen Laibow-Koser wrote: > Andrew wrote: > > I made a new app and I started from scratch. After following the steps > > in my previous posts, I still get 406 errors. > > [...] > > Hmm.  I forgot to ask: what's

[Rails] Re: RJS not rendering correctly when mime-type is 'iphone'

2009-04-30 Thread Marnen Laibow-Koser
Andrew wrote: > I made a new app and I started from scratch. After following the steps > in my previous posts, I still get 406 errors. [...] Hmm. I forgot to ask: what's the name of the RJS file? I should be something.iphonejs.rjs... Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@ma

[Rails] Re: RJS not rendering correctly when mime-type is 'iphone'

2009-04-30 Thread Andrew
I made a new app and I started from scratch. After following the steps in my previous posts, I still get 406 errors. This is so strange; it seems like I'm the only one in the world having this problem with 2.3! Anything else I can do? On Apr 19, 3:25 pm, Marnen Laibow-Koser wrote: > Andrew wrote

[Rails] Re: Posting a form from Rails programatically

2009-04-30 Thread 7stud --
7stud -- wrote: > I should add that I want to redirect the user whoops. -- 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,

[Rails] Re: Mail Daemon Error

2009-04-30 Thread Richard Schneeman
fixed here... http://groups.google.com/group/peepcode/browse_thread/thread/39cb413c4c926490?fwc=1&pli=1 Richard, www.uniteddictionary.com -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[Rails] Re: How do i stop rails from cacheing a link

2009-04-30 Thread Morgan Morgan
Morgan Morgan wrote: > I've got a controller that saves changes to a file and displays the > file.. > > well, the controller the saves the file renders the controller that > displays the file after it saves the file (i'm sure there's a better way > to do this but i haven't figured it out yet). >

[Rails] Re: Posting a form from Rails programatically

2009-04-30 Thread 7stud --
Neil Middleton wrote: > How would I go about creating and posting a form POST request from > inside some Rails code? > The use case I have is that I have received a form request, and I > would like to forward this request on to a third party with my > parameters intact. > > I should add that I wa

[Rails] How do i stop rails from cacheing a link

2009-04-30 Thread Morgan Morgan
I've got a controller that saves changes to a file and displays the file.. well, the controller the saves the file renders the controller that displays the file after it saves the file (i'm sure there's a better way to do this but i haven't figured it out yet). at the bottom of the displayed fil

[Rails] MacVim and rails.vim not working

2009-04-30 Thread 7stud --
Hi, I'm having trouble getting rails.vim working. Unzipping the rails.vim download on my Desktop produced a rails folder with this structure: rails ---autoload -rails.vim ---doc -rails.txt ---plugin -rails.vim I moved that directory to ~/.vim $ mv /Users/me/Desktop/rails ~/.vim/r

[Rails] Re: how-to introduce a rails patch to the dev community?

2009-04-30 Thread Pratik
Hey Emanuele, Two ways mainly : 1. #rails-contrib IRC channel 2. http://groups.google.com/group/rubyonrails-core mailing list Thanks ! On Thu, Apr 30, 2009 at 7:38 PM, Emanuele Tozzato wrote: > > Hello, > > do you usually say 'hey guys check what I just submitted to > lighthouse?' or just sit

[Rails] Unable to install RMagick

2009-04-30 Thread Lakshmi Kaza
Hi All, I am new to rmagick and ruby. I am using ruby 1.8.6 version Actually i downloaded rmagic2.9.0 win32 version and i unzipped it and i installed imageMagic-6.4.8. Then from command prompt i gave gem update --system. C:>gem update --system Updating RubyGems Nothing to update then C:>gem

[Rails] Posting a form from Rails programatically

2009-04-30 Thread Neil
How would I go about creating and posting a form POST request from inside some Rails code? The use case I have is that I have received a form request, and I would like to forward this request on to a third party with my parameters intact. I should add that I want to redirect the user out to the t

[Rails] Re: ActionMailer view template:

2009-04-30 Thread James Byrne
James Byrne wrote: The problem occurs even if the output line is a literal: <% if true -%> <%= "print this" %> <% end -%> <% for currency in @rates -%> <% if currency[2] == 'USD' -%> <%= "print this" %> <% end -%> <% end -%> gives this: print this

[Rails] Re: problem with nil.user

2009-04-30 Thread Stephen Fagan
E. Litwin wrote: > When are you saving the user_id to the session? > > You need to force a redirect to a login page if there is no session > [:user_id] and you should also handle the fact that session[:user_id] > may be nil in your is_logged_in? method. > Its saved in the login method: user =

[Rails] Re: how-to introduce a rails patch to the dev community?

2009-04-30 Thread Fernando Perez
> Try getting some interest on freenode#rubyonrails irc. Do not get your > hopes up though. To get more attention you can also post pictures of nude women, preferably during a rails conference. DHH will love you ;-) -- Posted via http://www.ruby-forum.com/. --~--~-~--~~---

[Rails] ActionMailer view template:

2009-04-30 Thread James Byrne
I am attempting to generate a plain text list from an array of arrays. If I do this: <% for currency in @rates -%> <% if currency[2] == 'USD' -%> <%= currency[2] -%> ... <%= currency[4] %> <% end -%> <% end -%> Then I see this:

[Rails] Re: how-to introduce a rails patch to the dev community?

2009-04-30 Thread James Byrne
Emanuele Tozzato wrote: > Hello, > > do you usually say 'hey guys check what I just submitted to > lighthouse?' or just sit and wait ? > > (https://rails.lighthouseapp.com/projects/8994/tickets/2582-actionviewtexthelper-graceful-truncate) > > E. Try getting some interest on freenode#rubyonrail

[Rails] how-to introduce a rails patch to the dev community?

2009-04-30 Thread Emanuele Tozzato
Hello, do you usually say 'hey guys check what I just submitted to lighthouse?' or just sit and wait ? (https://rails.lighthouseapp.com/projects/8994/tickets/2582-actionviewtexthelper-graceful-truncate) E. --~--~-~--~~~---~--~~ You received this message because

[Rails] Re: Cannot get jquery to work

2009-04-30 Thread pharrington
yeah, if you still have javascript_include_tag :defaults, prototype will still get loaded If you want to keep prototype loaded though (to take advantage of Rails builtin AJAX functionality for example), http://docs.jquery.com/Using_jQuery_with_Other_Libraries will be of use On Apr 30, 2:13 pm, B

[Rails] ActiveRecord::Base.establish_connection loads once?

2009-04-30 Thread elioncho
Hello guys, I'm using the establish connection method on my models to connect to different databases. My question is : Is it possible to connect to various databases dynamically as I'm trying to do (I am sending a name param) or does the connection params are only loaded once and can't be changed

[Rails] Re: Image from database and display

2009-04-30 Thread Brendon
Yes... the image is fetched by the browser as a completely separate request, so you need to be able to handle that request. On Apr 30, 11:22 am, Shandy Nantz wrote: > I got it, here is what I did: > > View: > >   <%= image_tag("/admin/code_image...@image.id}", :alt => "Image") %> > > Controller

[Rails] Exception notifier and rails 2.3, does it work?

2009-04-30 Thread fausto
Hi, i've just installed exception notifier, set in the enviroment.rb (i've tried also in an inizializer file and in production.rb in the enviroments folder) ExceptionNotifier.exception_recipients = %w(m...@mail.com) ExceptionNotifier.sender_address = %("Application Error" ) ExceptionNotifier.emai

[Rails] Re: Image from database and display

2009-04-30 Thread Shandy Nantz
I got it, here is what I did: View: <%= image_tag("/admin/code_image/#...@image.id}", :alt => "Image") %> Controller - code_image def code_image @image_data = Image.find_by_id(params[:id]) @image = @image_data.img send_data (@image, :disposition => 'inline') end Hope this is

[Rails] Re: Why inconsistent validation with .new ?

2009-04-30 Thread Greg Willits
Frederick Cheung wrote: > On Apr 30, 6:46�pm, Greg Willits > wrote: >> (Rails 2.3.2, �OS X 10.5, MySQL 5.0.x) >> >> I have combed through all my callbacks, even commented them out. Nothing >> in there appears to be the problem (nothing forcing a save that I can >> see). >> > > "Adding an object

[Rails] Re: Automatically delete oldest post of a specified tag

2009-04-30 Thread Victor Vlist
Thank you Franco for being so helpful and understanding. I appreciate it. -- 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

[Rails] Re: Cannot get jquery to work

2009-04-30 Thread Brendon
Are you sure you are not including prototype.js? On Apr 29, 11:39 pm, Anil wrote: > <%= javascript_include_tag "jquery.js" %> > > I want to add class to table tag using following command  inside > script tag. > > (document).ready( function() { >             $('tr:odd').addclass('odd'); >      

[Rails] Restful_authentication doesn't work in Rails 2.3.2

2009-04-30 Thread Sam Kong
Hi, I'm using restful_authentication on rails 2.3.2. It works find on my local machine which has passenger 2.1.2. But it doesn't work on the web hosting server (DreamHost) which may have lower version of passenger. The problem is session[:user_id] is not reserved while redirecting. Is this an in

[Rails] Re: is possbile limit the number of object in has_many option?

2009-04-30 Thread Rob Biedenharn
On Apr 30, 2009, at 1:29 PM, serenobs wrote: > > thanks for replies. > it gives me some thought about making active record association. > > then what if the man is a single? > husband may not have current_marriage. > i was thinking that has_one means it should have one object. > But as you know n

[Rails] Re: is possbile limit the number of object in has_many option?

2009-04-30 Thread Rob Biedenharn
On Apr 30, 2009, at 12:56 PM, Commander Johnson wrote: > Did you consider > > has_one :wife > > And in Wife.rb > > belongs_to :man Or: class Wife has_many :marriages has_one :current_marriage, :class_name => 'Marriage', :conditions => { :current => true } has_one :husband, :through =>

[Rails] Re: Why inconsistent validation with .new ?

2009-04-30 Thread Frederick Cheung
On Apr 30, 6:46 pm, Greg Willits wrote: > (Rails 2.3.2,  OS X 10.5, MySQL 5.0.x) > > I have combed through all my callbacks, even commented them out. Nothing > in there appears to be the problem (nothing forcing a save that I can > see). > "Adding an object to a collection (has_many or has_and

[Rails] Re: Why inconsistent validation with .new ?

2009-04-30 Thread Greg Willits
Greg Willits wrote: > Assuming (shortened for email): > > class Article < AR::Base > has_many :pages > end > class Pages < AR::Base > belongs_to :pages > end Oops. Email typo -- of course that should be: class Pages < AR::Base belongs_to :article end -- gw -- Posted vi

[Rails] Re: Automatically delete oldest post of a specified tag

2009-04-30 Thread Franco Catena
> The callback would be placed in the post model correct? Yes. > And that callback would include code that would find the > amount of posts in that tag if it exists? Yes. > Then how would I use that in the post controller's create > method? When you call @post.save in the controller the appropiate

[Rails] Why inconsistent validation with .new ?

2009-04-30 Thread Greg Willits
(Rails 2.3.2, OS X 10.5, MySQL 5.0.x) I'm seeing some odd behavior that makes no sense to me with respect to adding new empty records to an ActiveRecord object. Assuming (shortened for email): class Article < AR::Base has_many :pages end class Pages < AR::Base belongs_to :pages

[Rails] Re: is possbile limit the number of object in has_many option?

2009-04-30 Thread serenobs
thanks for replies. it gives me some thought about making active record association. then what if the man is a single? husband may not have current_marriage. i was thinking that has_one means it should have one object. But as you know not every man will marry. please more advice for this novice.

[Rails] Re: We're sorry, but something went wrong.

2009-04-30 Thread 7stud --
Bharat Ruparel wrote: > One thing that you may or may not know is that the default session > storage for Rails is cookies now. I followed some instructions to uncomment one line in config/initializers/session_store.rb (rails 2.3), which created database storage for sessions, hence the repeate

[Rails] Re: Automatically delete oldest post of a specified tag

2009-04-30 Thread Victor Vlist
The callback would be placed in the post model correct? And that callback would include code that would find the amount of posts in that tag if it exists? Then how would I use that in the post controller's create method? Sorry I'm still trying to grasp MVC :( -- Posted via http://www.ruby-foru

[Rails] Re: Cannot get jquery to work

2009-04-30 Thread Hassan Schroeder
On Thu, Apr 30, 2009 at 9:58 AM, Anil wrote: Oh, wait -- >

[Rails] Re: Goldberg breaks (almost) all functional tests

2009-04-30 Thread Commander Johnson
I just found out that I double posted! Please excuse me for that. On Thu, Apr 30, 2009 at 6:53 PM, Commander Johnson < commanderjohn...@gmail.com> wrote: > Anyone else have that if you protect certain actions with Goldberg, you > can't test them anymore? > > I know some of you are using Goldberg

[Rails] Re: Cannot get jquery to work

2009-04-30 Thread Anil
Thanks Hassan Schroeder, The File is loaded correctly. And I tried both <%= javascript_include_tag 'jquery' %> <%= javascript_include_tag "jquery.js" %> And both load the file correctly. Moreover I can see the JavaScript (JQuery.js) loaded using firebug. Still No luck. Thanks On Apr 30, 7

[Rails] Re: is possbile limit the number of object in has_many option?

2009-04-30 Thread Commander Johnson
Did you consider has_one :wife And in Wife.rb belongs_to :man On Thu, Apr 30, 2009 at 6:49 PM, serenobs wrote: > > (my post was deleted i don't know why) > Hi. I have a question. > for example, when model records about man, suppose man can marry with > 1 woman. > then i think code will be lik

[Rails] Re: Different behaviour on ActiveResorce with JSON or XML

2009-04-30 Thread Paulo Pereira
Should it be better to post in the Rails Lighthouse? On Apr 29, 12:59 pm, Paulo Pereira wrote: > I'm doing a request from a Rails app to another Rails app with > ActiveResource. > > When the format on ActiveResource is XML: > > Content.find(:all)[0,2].map(&:attributes) > => [ >   {"updated_at"=>

[Rails] Goldberg breaks (almost) all functional tests

2009-04-30 Thread Commander Johnson
Anyone else have that if you protect certain actions with Goldberg, you can't test them anymore? I know some of you are using Goldberg today so how did you manage that? Keep the controllers as simple as possible? Test them yourself? Options include: - Log in a Goldberg user before loading test s

[Rails] is possbile limit the number of object in has_many option?

2009-04-30 Thread serenobs
(my post was deleted i don't know why) Hi. I have a question. for example, when model records about man, suppose man can marry with 1 woman. then i think code will be like this class Man < ActiveRecord::Base has_many: wife end Because one man can marry with up to 1 woman( 0 or 1 ) it can't be

[Rails] Re: Alternative coding for decimal arithmetic

2009-04-30 Thread James Byrne
Marnen Laibow-Koser wrote: > Use BigDecimal (part of the standard library). It does > arbitrary-precision decimal arithmetic without the problems of floats. > I think the syntax would be something like Thanks, that works much better. -- Posted via http://www.ruby-forum.com/. --~--~

[Rails] Re: error with test:functionals

2009-04-30 Thread Colin Law
I think that the message is saying that the value of Artist.count after the create is 1 when it should be 2, rather than the expected difference being 2, though I am not sure whether this is what you are confused about or not. By the way, assert_difference('Artist.count', 1) do may be what you wan

[Rails] Re: strange NoMethodError when trying to work in production mode

2009-04-30 Thread Frederick Cheung
On Apr 30, 4:41 pm, Shilo Ayalon wrote: > my validations are in a file inside lib folder:http://pastie.org/463883 > > Not so sure what I'm doing wrong, since all of that worked great while > in development mode. I'd appreciate any help offered - thanks. see this blog post I wrote a few months

[Rails] Image from database and display

2009-04-30 Thread Shandy Nantz
I have an image saved in a database and am trying to display it in my view. Here is my code: View- <%= image_tag( url_for :action => 'image', :id => 1, :pseudo_id => @pseudo.id) %> Controller- @image = Image.find(:first, :conditions => ['enpseudo_id = ?', @pseudo.id]) send_data @img.img, :conten

[Rails] Integrate test process with Rspec and Cucumber in a plugin using Desert

2009-04-30 Thread romain endelin
Hello, I'm developing some rails plugins with desert, and I would like to use tests with RSpec and Cucumber in the development. RSpec is integrated by default in Desert plugins, but it gives me some bugs. Finally I have created a minimal application which use my plugin, and I try to test it like a

[Rails] Proper way to extend an app engine model

2009-04-30 Thread Brent Dillingham
Can anyone tell me the "proper" way to extend a model provided by an app engine (or any plugin for that matter). I'm attempting to extend an app engine model by adding a has_many :through. So I've got lib/myplugin_ext.rb and I'm requiring that file in evironment.rb. My extension uses class_eval t

[Rails] Re: We're sorry, but something went wrong.

2009-04-30 Thread Bharat
One thing that you may or may not know is that the default session storage for Rails is cookies now. Therefore, if you have any unexpected failures and subsequent bizarre behaviour in your application, first thing to do is to clear cookies, otherwise you will be chasing either wrong problems or n

[Rails] Re: strange NoMethodError when trying to work in production mode

2009-04-30 Thread Shilo Ayalon
Shilo Ayalon wrote: > Hi - I'm trying to see how my app behaves in production environment by > running the development server with -e production: > appdir~$ ./script/server -p production the above should obviously be ./script/server -e production that's just a typo on my part. still could use he

[Rails] strange NoMethodError when trying to work in production mode

2009-04-30 Thread Shilo Ayalon
Hi - I'm trying to see how my app behaves in production environment by running the development server with -e production: appdir~$ ./script/server -p production => Booting Mongrel => Rails 2.3.2 application starting on http://0.0.0.0:3000 /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_r

[Rails] Re: end_of_month()

2009-04-30 Thread Michael Moulsdale
I have also noticed this, and it is driving me up the wall. Any way around it? -- 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

[Rails] Re: Alternative coding for decimal arithmetic

2009-04-30 Thread Marnen Laibow-Koser
James Byrne wrote: > > I cannot drop to floating point. It has to be integer arithmetic. Use BigDecimal (part of the standard library). It does arbitrary-precision decimal arithmetic without the problems of floats. I think the syntax would be something like (BigDecimal.new(1) / BigDecimal.n

[Rails] Re: controller/ URL not working without controller/index

2009-04-30 Thread wejrow...@gmail.com
I think I figured it out. I needed to have: map.resources :portfolios NOT: map.resource :portfolios (plural, not singular resources) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To p

[Rails] Re: modernizing my rails chops

2009-04-30 Thread Nicholas Van Weerdenburg
Check github for latest installation instructions for different versions of rails- http://wiki.github.com/dchelimsky/rspec/rails Gems are now the recommended installation mechanism unless running from edge (as described on github and the RSpec beta book). Regards, Nick On Sun, May 4, 2008 at 9:3

[Rails] error with test:functionals

2009-04-30 Thread Luciano
Hello there, I working on my tests but I getting this strange errror: I can see on the database that the object was created but I still got an failure on my test. this is my test code: test "should create artist" do assert_difference('Artist.count', difference = 1) do post :create, :

[Rails] Re: is possible limit the number of has_many objects?

2009-04-30 Thread Robert Walker
Colin Law wrote: > 2009/4/30 Colin Law > >> Use >> has_one :wife > > > On second thoughts I am not sure about this, writing > > class Wife < ActiveRecord::Base > belongs_to :husband > end > > may well get you into serious trouble. This is actually one of the more interesting examples. In

[Rails] Re: Cannot get jquery to work

2009-04-30 Thread Hassan Schroeder
On Wed, Apr 29, 2009 at 11:39 PM, Anil wrote: > > <%= javascript_include_tag "jquery.js" %> Shouldn't that be <%= javascript_include_tag 'jquery' %> You could probably easily discover whether your jquery file is being loaded by using Firebug, btw HTH, -- Hassan Schroeder -

  1   2   >