[Rails] sending email with attachments

2010-08-29 Thread Tom Mac
Hi Could anyone please give an example of sending mails with attachments in rails using actionmailer? I have a user in users table whose attachments is stored in attachments table it self( Relation is user has_many attachments ; attachment belongs_to user). Sender for example is ad...@example.

[Rails] Re: How to override a template file in a gem?

2010-08-29 Thread Commander Johnson
Found it: In preinitializer.rb, i modified the last couple of lines: require "rubygems" if version #gem 'refinerycms', version else #gem 'refinerycms' end require 'vendor/gems/refinerycms-0.9.6.25/lib/refinery_initializer' --- This way the gem is loaded from vendor/gems witho

Re: [Rails] Re: Can't quit server in Rails 3

2010-08-29 Thread ChenJie|抽屉
On Mon, Aug 30, 2010 at 11:17, pauld wrote: > Hi-- > > My answers below. > > > > On Aug 30, 9:44 am, ChenJie|抽屉 wrote: > > On Mon, Aug 30, 2010 at 08:57, pauld wrote: > > > Just wanted to append some more information. > > > > > Looks like after the rails server starts, it doesn't hand control b

[Rails] Re: Can't quit server in Rails 3

2010-08-29 Thread Davo
To quit the server try control + Break as an alternative! On Aug 30, 11:17 am, pauld wrote: > Hi-- > > My answers below. > > On Aug 30, 9:44 am, ChenJie|抽屉 wrote: > > > > > > > > > > > On Mon, Aug 30, 2010 at 08:57, pauld wrote: > > > Just wanted to append some more information. > > > > Looks

[Rails] Re: rspec - bash: rspec: command not found

2010-08-29 Thread nobosh
Same issue with this command in the tutorial: "spork --bootstrap" On Aug 29, 8:30 pm, nobosh wrote: > Hello, I'm going through the Rails 3 book (which is awesome by the > way) here:http://railstutorial.org/chapters/static-pages#top > > In the book it has me using "rspec" which is installed: >

[Rails] Re: in a rails3 - rspec then require 'authlogic/test_case' and now I broke stuff?

2010-08-29 Thread Rick R
On Sun, Aug 29, 2010 at 11:36 PM, Rick R wrote: > > I 'think' what started the problems was when I added at the top of a > controller test: > > require 'authlogic/test_case' > > After doing that, I seemed to have to re-run 'bundle install' (or maybe > that was triggered because I touched the Gemf

[Rails] in a rails3 - rspec then require 'authlogic/test_case' and now I broke stuff?

2010-08-29 Thread Rick R
I'm a newb here and probably shouldn't be using Rails3 yet to start with, but for some reason I was feeling adventurous. I'm also learning to use rspec along the way and things 'were' working out with my 'rake spec' until I tried to follow some examples for test Authlogic with rspec. I 'think' wh

[Rails] rspec - bash: rspec: command not found

2010-08-29 Thread nobosh
Hello, I'm going through the Rails 3 book (which is awesome by the way) here: http://railstutorial.org/chapters/static-pages#top In the book it has me using "rspec" which is installed: bundle show rspec /Library/Ruby/Gems/1.8/gems/rspec-2.0.0.beta.18 But when I go to run the test, "rspec spec/" I

[Rails] Re: Can't quit server in Rails 3

2010-08-29 Thread pauld
Hi-- My answers below. On Aug 30, 9:44 am, ChenJie|抽屉 wrote: > On Mon, Aug 30, 2010 at 08:57, pauld wrote: > > Just wanted to append some more information. > > > Looks like after the rails server starts, it doesn't hand control back > > to bash in the terminal. Say this because the normal pro

[Rails] Re: rails 3 : german umlauts in controller

2010-08-29 Thread Tor Erik Linnerud
Ruby 1.9 doesn't interpret the source file as UTF-8 unless it is specified at the top of the file like this: # encoding: utf-8 Try adding it to the first line of your controller file. Tor Erik -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed t

Re: [Rails] Re: Rails 3 - the most annoying deprecation warning

2010-08-29 Thread Rob Biedenharn
On Aug 29, 2010, at 8:50 PM, Bharat Ruparel wrote: "If save(false) isn't something that you're calling in your code it is likely in plugins or gems that you're loading." --- Thank you for your time. This makes sense. However, there is not a single place in my application where I am callin

Re: [Rails] Re: Can't quit server in Rails 3

2010-08-29 Thread ChenJie|抽屉
On Mon, Aug 30, 2010 at 08:57, pauld wrote: > Just wanted to append some more information. > > Looks like after the rails server starts, it doesn't hand control back > to bash in the terminal. Say this because the normal prompt signs > don't show up in bash. So the question becomes why doesn't it

[Rails] Re: Automatically create one child record when parent record is initially created

2010-08-29 Thread Chris
I think I've improved on it and made it transactional (please correct me if I'm wrong). My new code look as follows: @user = User.new(params[:user]) @user.user_sites << UserSite.new(:site_id => @current_site.id) if @user.save ... I'm using the new method instead of the create on the UserSite obj

[Rails] Re: Can't quit server in Rails 3

2010-08-29 Thread pauld
Just wanted to append some more information. Looks like after the rails server starts, it doesn't hand control back to bash in the terminal. Say this because the normal prompt signs don't show up in bash. So the question becomes why doesn't it hand control back to bash, and how can this be changed

[Rails] Re: Automatically create one child record when parent record is initially created

2010-08-29 Thread Chris
I am using Rails 3. I got it to work with the following code, but it is not currently transactional (if the creation of a UserSite fails the original user record will still exist in the db). @user = User.new(params[:user]) if @user.save @user.user_sites << UserSite.create(:site_id => @current_

[Rails] Re: Automatically create one child record when parent record is initially created

2010-08-29 Thread Chris
I am using Rails 3. I got it to work with the following code, but I haven't done anything to make it transactional (a user record will get created even if the second creation fails) @user = User.new(params[:user]) if @user.save @user.user_sites << UserSite.create(:site_id => @current_site.id) O

[Rails] Re: Rails 3 - the most annoying deprecation warning

2010-08-29 Thread Bharat Ruparel
"If save(false) isn't something that you're calling in your code it is likely in plugins or gems that you're loading." --- Thank you for your time. This makes sense. However, there is not a single place in my application where I am calling save(false) and this warning is triggered all over the

[Rails] Can't quit server in Rails 3

2010-08-29 Thread pauld
After Rails 3 was just released today, I downloaded it and followed the instructions on Rails Guide for building my first app at Getting Started with Rails http://guides.rubyonrails.org/getting_started.html Everything worked fine until I got to 4.2 Say "Hello" Rails. Entered the "rails generate ho

[Rails] Re: Updating to Rails 3 on Mac OS X

2010-08-29 Thread nobosh
lol can't wait. Your trick below worked. Thanks. I'm looking forward to upgrading in a few hours! On Aug 29, 4:32 pm, Parker Selbert wrote: > nobosh wrote: > > Update 3, after getting all the dependencies installed, it's still > > erroring: > > > sudo gem install rails --pre > > Successfully inst

[Rails] Re: Rails 3 - the most annoying deprecation warning

2010-08-29 Thread Parker Selbert
Parker Selbert wrote: > (ActiveRecord::Persistence) > save(options) > Saves the model. > > If the model is new a record gets created in the database, otherwise the > existing record gets updated. > By default, save always run validations. If any of them fail the action > is cancelled and save re

[Rails] Re: Rails 3 - the most annoying deprecation warning

2010-08-29 Thread Parker Selbert
> DEPRECATION WARNING: save(false) is deprecated, please give > save(:validate => false) instead. (called from save at > /home/bruparel/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0.rc2/lib/active_record/validations.rb:43) >From the 2.3.8 Docs: (ActiveRecord::Base) save(perform_validation = tru

[Rails] Re: Newbie Qs - Authentication Plugin that supports Instances? Also, Rails 2.3 or 3 for Beginners?

2010-08-29 Thread Parker Selbert
nobosh wrote: > @Peter, thanks for the reply, very helpful. > > #1 - I'm going to go with Devise, I found a railscasts video that > should make installing it easy Devise is great. Clearance works well also, though it has fewer options. Clearance is email based by default, you would have to add u

[Rails] Re: Updating to Rails 3 on Mac OS X

2010-08-29 Thread Parker Selbert
nobosh wrote: > Update 3, after getting all the dependencies installed, it's still > erroring: > > sudo gem install rails --pre > Successfully installed rails-3.0.0.rc2 > 1 gem installed > Installing ri documentation for rails-3.0.0.rc2... > File not found: lib > > Ideas? It looks like it actual

[Rails] Re: Updating to Rails 3 on Mac OS X

2010-08-29 Thread nobosh
Update 3, after getting all the dependencies installed, it's still erroring: sudo gem install rails --pre Successfully installed rails-3.0.0.rc2 1 gem installed Installing ri documentation for rails-3.0.0.rc2... File not found: lib Ideas? On Aug 29, 3:32 pm, nobosh wrote: > Running "sudo gem

[Rails] Re: will_paginate

2010-08-29 Thread Jeff Chen
The manage_c0ntroller.rb: class ManageController < ApplicationController def index list render :action => 'list' end # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], :redirect_t

[Rails] Updated Internet file managers for Rails 2.3.8 and Rails 3.0

2010-08-29 Thread Bharat Ruparel
http://github.com/bruparel/file_manager238 http://github.com/bruparel/file_manager3 Just got done. Enjoy. Bharat -- 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 emai

[Rails] Re: Updating to Rails 3 on Mac OS X

2010-08-29 Thread nobosh
Running "sudo gem install rails --pre" seemed to make it happier, only error'd now with: ERROR: Error installing rails: activemodel requires builder (~> 2.1.2, runtime) On Aug 29, 3:17 pm, nobosh wrote: > Hello, I'm working to install Rails 3 (pre) on my Mac, from the Rails > blog pos

[Rails] Updating to Rails 3 on Mac OS X

2010-08-29 Thread nobosh
Hello, I'm working to install Rails 3 (pre) on my Mac, from the Rails blog post it says to run: gem install rails --pre After running that command I get the following errors: WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and /usr/bin aren't both writable. WARNING: You d

[Rails] Re: Newbie Qs - Authentication Plugin that supports Instances? Also, Rails 2.3 or 3 for Beginners?

2010-08-29 Thread nobosh
@Peter, thanks for the reply, very helpful. #1 - I'm going to go with Devise, I found a railscasts video that should make installing it easy #2 - I'll go with Rails 3, might as well learn the new stuff #3 - Regarding "That's your job, you just make the necessary model relationships to handle it."

Re: [Rails] Newbie Qs - Authentication Plugin that supports Instances? Also, Rails 2.3 or 3 for Beginners?

2010-08-29 Thread Peter De Berdt
On 29 Aug 2010, at 21:37, nobosh wrote: Is there an authentication plug-in that supports that? ie 1. Registration that is email based (no usernames) If it isn't the default, it's certainly an option in the most popular authentication plugins out there: AuthLogic and Devise. Which one to c

[Rails] Re: Re: Re: Sort table by price and print the cheapest price car

2010-08-29 Thread Dakshata Gulkhobare
Thank you Colin, Thank you Marnen for your reply, @Colin: I was using seed because I had just finished populating the DB and was just trying to write the program in the seed to make running the program easier, nothing particular. Now I have written and called the method somewhere else. The ch

[Rails] rails not rerouting to new page

2010-08-29 Thread Rich d
i am running virtual rails on linux mint. i created a controller in my commnad prompt. then i opened up the public folder and delted index.html .. after this I opened up the rails application i created and went to config / routes.rb. I am trying to re route or add a new route to the default page

[Rails] Newbie Qs - Authentication Plugin that supports Instances? Also, Rails 2.3 or 3 for Beginners?

2010-08-29 Thread nobosh
Hello, this is my first week with Rails. I'm working to create an app that has Users associated to instances by their email address. For example, like Yammer, those with the email domain "yahoo.com" only see what others with the same domain see... Also like Basecamp where you only see your stuff b

[Rails] How to get rid of automatic orthography corrections?

2010-08-29 Thread Fritz Trapper
In my template, I wrote: <%= f.label 'GnuPlot-Anweisungen:' %> And rails converts this label to Gnuplot anweisungen: How to get rid of this feature? By the way: this behaviour is hated by german users of MS Office and the M$ guys are unable to suppress it ;-) -- Posted via http://www

[Rails] More deprecation warnings

2010-08-29 Thread Bharat Ruparel
How can I fix the following code for deprecation warning? def correct_client_assignment role = Role.find_by_name('eclient') if client_id.blank? && role_id == role.id errors.add :client_id, "must assign an external client to this user" elsif !client_id.blank? && role_id != role.

[Rails] rails 3 : german umlauts in controller

2010-08-29 Thread Sven Koesling
Hi everybody, with rails 3 I have the problem that the controllers don't accept german umlaute anymore. E.g. when I try to build an array: landschaft = %w[ Berg Hügel Tal Ebene] I get this lovely error message: ... controller.rb:5: invalid multibyte char (US-ASCII) Sure enough the document enco

Re: [Rails] Re: Automatically create one child record when parent record is initially created

2010-08-29 Thread Bill Walton
On Sun, Aug 29, 2010 at 12:34 PM, Chris wrote: > How would I handle a failure in that second piece?  Can I put it in > transaction and roll it back? Probabl, though you'd have to throw an exception for a transaction to be effective. IIRC, Rails3 has support for creating associated records built

[Rails] How to override a template file in a gem?

2010-08-29 Thread Commander Johnson
Hello, I'm working with Refinery 0.9.6.25 which has a small bug in a partial file. Is there a way to override this file from within my application's directory as to fix the bugged line of code? The file is, from the gem's working dir, vendor/plugins/refinery/app/views/shared/admin/_resource_picke

[Rails] Rails 3 - the most annoying deprecation warning

2010-08-29 Thread Bharat Ruparel
I just successfully converted my Rails 2.3.8 app to Rails 3.0 Release candidate 2! I will post both the apps on my github account for everyone else. I do want to clean up the deprecation warnings as best as I can before I post them though. By far the most frequent deprecation warning that shows

[Rails] Re: Automatically create one child record when parent record is initially created

2010-08-29 Thread Chris
How would I handle a failure in that second piece? Can I put it in transaction and roll it back? On Aug 29, 1:31 pm, Bill Walton wrote: > Hi Chris, > > On Sun, Aug 29, 2010 at 12:24 PM, Chris wrote: > > Sorry for the newbie question in advance...  I've got three models, a > > user, site and use

Re: [Rails] Automatically create one child record when parent record is initially created

2010-08-29 Thread Bill Walton
Hi Chris, On Sun, Aug 29, 2010 at 12:24 PM, Chris wrote: > Sorry for the newbie question in advance...  I've got three models, a > user, site and user_site model.  A site can have many users and a user > can have many sites.  The relationship between these two is stored in > user_site. In my mode

[Rails] Automatically create one child record when parent record is initially created

2010-08-29 Thread Chris
Sorry for the newbie question in advance... I've got three models, a user, site and user_site model. A site can have many users and a user can have many sites. The relationship between these two is stored in user_site. In my model defs user and sites both have has_many user_sites statement. Wit

[Rails] polymorphic help

2010-08-29 Thread Christian Fazzini
With the help of some devs. I was able to list down commends of a specific deal using the "def comments" method in the deal model class. However, what I also need is to display the owner/user who made the comment via the @deal.comments loop. For example, something like this would be ideal: <% @de

[Rails] Re: Wrong class being returned in association

2010-08-29 Thread José Ignacio
After some research it seems that's not the cause of the problem. I created a blank project, removed all plugins and the error persisted: > User.last.conversations.find(Conversation.last.id).users.last.instance_of?(User) => true > reload! Reloading... => true > User.last.conversations.find(Conver

[Rails] match default verb

2010-08-29 Thread Mike
The default verb for match is :any. This means for: match 'dog/bark(/:num)' => 'dogs#bark' # get 3 barks match 'dog/eat' => 'dogs#eat' # post breakfast someone could post on dog/bark with :louder or get on dog/eat with :breakfast. This is annoying and messy, and definitely not RESTful.

Re: [Rails] Re: will_paginate

2010-08-29 Thread Colin Law
On 29 August 2010 13:10, Jeff Chen wrote: Please don't top post it makes it more difficult to follow the thread Thanks >... > 1. The environment.rb: > > RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION > > # Bootstrap the Rails environment, frameworks, and default > configuration >

[Rails] Re: WHICH Hosting

2010-08-29 Thread Kaspir Ghost
I don't know about cheap, but I use dreamhost and it's awesome. They support every language -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...

[Rails] Help with prev/next links

2010-08-29 Thread Kaspir Ghost
I've written a Image Gallery app in rails. It contains photo albums, in which you can upload photos, then click on an individual photo to view it's larger size. When you bring up the larger size, I have previous and next buttons to go through the photos in the album. My problem is when navigating t

[Rails] Re: Wrong class being returned in association

2010-08-29 Thread Frederick Cheung
On Aug 29, 1:24 pm, José Ignacio wrote: > That makes a lot of sense. I'm using authlogic and acts_as_follower in > the user model. Turning them off to check which one is producing the > issue is hard, but I'll have to try. Is there a way to force plugin > classes to reload? Or, what could be the

[Rails] Re: Wrong class being returned in association

2010-08-29 Thread José Ignacio
That makes a lot of sense. I'm using authlogic and acts_as_follower in the user model. Turning them off to check which one is producing the issue is hard, but I'll have to try. Is there a way to force plugin classes to reload? Or, what could be the 'best practice' that is not being followed in

[Rails] Re: Wrong class being returned in association

2010-08-29 Thread Frederick Cheung
On Aug 29, 11:39 am, José Ignacio wrote: > > This last evaluation is wrong, and breaks equality checks and > expressions such as @conversation.users.include?(some_user) > > If I enable class caching, the problem disappears (but that's not > ideal for development). Maybe I'm doing something that

[Rails] Re: will_paginate

2010-08-29 Thread Jeff Chen
Dear Colin, Thanks. 1. The environment.rb: RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') Rails::Initializer.run do |config| # Settings in config/environm

[Rails] Wrong class being returned in association

2010-08-29 Thread José Ignacio
I'm using Rails 3.0.0rc and have the following models: class User  has_many :readings  has_many :conversations, :through=>:readings end class Reading  belongs_to :user  belongs_to :conversation end class Conversation  has_many :readings  has_many :users, :through=>:readings end and this control

Re: [Rails] WHICH Hosting

2010-08-29 Thread Sterling Cooley
Heroku is probably the best as of now. -Sterling On Aug 29, 2010, at 12:24 AM, Ainar Abramovich wrote: > I'm hosting my website on Hostmonster.com, when my website was built > on.php it was fast BUT now when I've changed it and I'm running Ruby > on Rails it loads and refreshes too slw, w

[Rails] [ANN] Troll - A Rails plugin for making webservice mocking easier

2010-08-29 Thread hemant
Hi Folks, Troll trumps your existing ActiveResource mocking libraries like inbuilt HttpMock,Fakeweb or Webmock out of water. With Troll, ActiveResource mocking just works, some of its features: 1. Don't need to mock calls at Net::HTTP level (which webmock,fakeweb do). Really, we don't care what

Re: [Rails] Re: will_paginate

2010-08-29 Thread Colin Law
On 29 August 2010 03:44, Jeff Chen wrote: > Thanks. > > But I config.gem 'will_paginate' before the end of environment.rb and > f the will_paginate is already installed but not worked.  Got the > undefined method `paginate' for # Why? May you give > me a hint, or sample, let me fix it up. config.

[Rails] WHICH Hosting

2010-08-29 Thread Ainar Abramovich
I'm hosting my website on Hostmonster.com, when my website was built on.php it was fast BUT now when I've changed it and I'm running Ruby on Rails it loads and refreshes too slw, which is THE Best & Cheapest Hosting company for Ruby on Rails, someone? -- You received this message because