[Rails] Re: Re: Does anyone test errors in their specs?

2010-11-08 Thread Marnen Laibow-Koser
Marnen Laibow-Koser wrote in post #960256: [...] > This is the best stolidity I've been able to figure out. iPhone autocorrect strikes again. I meant "atomicity", not "stolidity". > > Best, > --  > Marnen Laibow-Koser > http://www.marnen.org > mar...@marnen.org -- Posted via http://www.ruby-fo

[Rails] Re: Re: Does anyone test errors in their specs?

2010-11-08 Thread Marnen Laibow-Koser
Philip Hallstrom wrote in post #960209: > On Nov 8, 2010, at 3:28 PM, Anthony Smith wrote: > >> My thought is that it verifies you're receiving the error you expected and >> not > an artifact from another issue. So my intention is not to test Rails but > to make > sure my tests are doing what I'm

Re: [Rails] When was callback registration introduced?

2010-11-08 Thread Jeffrey L. Taylor
Never mind, bitten by fixtures. They aren't created normally and the callbacks aren't called. Jeffrey Quoting Jeffrey L. Taylor : > I'm using Rails 2.3.5 and finding that for lines like these below in a model, > the block is never executed. Am I doing something wrong or was this > introduced in

Re: [Rails] Webrick Failing with Illegal Instruction

2010-11-08 Thread David Kahn
On Mon, Nov 8, 2010 at 9:46 PM, David Kahn wrote: > > > On Sun, Nov 7, 2010 at 7:51 PM, Ben Porterfield wrote: > >> I've just started a new rails project (3.0.1, ruby 1.9.2 on Mac OS X), >> and have a few parts of it built out. I've just created new >> controller/views using rails g scaffold_contr

Re: [Rails] Webrick Failing with Illegal Instruction

2010-11-08 Thread David Kahn
On Sun, Nov 7, 2010 at 7:51 PM, Ben Porterfield wrote: > I've just started a new rails project (3.0.1, ruby 1.9.2 on Mac OS X), > and have a few parts of it built out. I've just created new > controller/views using rails g scaffold_controller Lesson, and then > added a route to routes.rb with "res

[Rails] RAILS3 new validation class not working

2010-11-08 Thread Me
I am using the new validation class rails3 provides. The issue is it keeps giving me an error in the whole app of: :attributes cannot be blank here is the class below. I commented out all of the code to do anything but it still gives me the error. Ideas?? class FileUploadValidator < ActiveMo

[Rails] Re: Re: Re: Webrick Failing with Illegal Instruction

2010-11-08 Thread Ben Porterfield
It's even simpler than that. Chalk it up to a rails newbie - sorry for the bother. Here's what I did: Rails generated this: # GET /appointments/1 # GET /appointments/1.xml def show @appointment = Appointment.find(params[:id]) respond_to do |format| format.html # show.html.erb

[Rails] link_to using a hashed :token instead of :id

2010-11-08 Thread dwormuth
With Rails 3, how do I create a "link_to" reference that uses a pre- exisiting token value instead of the record id? Is there a way to use the URLHelpers to do this, or do I need to use the old style "link_to" syntax with action, controller, id etc? The documentation doesn't seem to provide any poi

[Rails] Rails 3 Action Mailer issue

2010-11-08 Thread vishy
Hi All, I am trying to send an email on a user sign up. The email is working without any issues. However there is a problem with the :from field that I am specifying. My SMTP setting look like : ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port

[Rails] Re: before_filter always running in test, not in development or production mode.

2010-11-08 Thread Keith Tom
John Postlethwait wrote in post #915199: > I found a way around this, though I still have no clue why this works: > > In my controller, if I add: > > def show > end > > The before filter DOES NOT run, as I expect, as soon as I remove the > def show;end the filter is once again applied to the #show

[Rails] When was callback registration introduced?

2010-11-08 Thread Jeffrey L. Taylor
I'm using Rails 2.3.5 and finding that for lines like these below in a model, the block is never executed. Am I doing something wrong or was this introduced in a later version of Rails? before_create :preprocess_score def preprocess_score puts "HERE: #{__LINE__}" self['score'] = Toke

[Rails] Re: How to return to a particular page in a paginated index?

2010-11-08 Thread Fritz Trapper
The solution is very simple: @records = Record.paginate( :page => params[:page] || session[:zb_page],# (2) :per_page => limit) session[:zb_page] = params[:page] if params[:page]# (1) + If a page was given, store it in the session cookie (1) + On paginateded find us

Re: [Rails] Re: Does anyone test errors in their specs?

2010-11-08 Thread Philip Hallstrom
On Nov 8, 2010, at 3:28 PM, Anthony Smith wrote: > My thought is that it verifies you're receiving the error you expected and > not an artifact from another issue. So my intention is not to test Rails but > to make sure my tests are doing what I'm expecting. Does that make sense or > am I just

Re: [Rails] Re: Does anyone test errors in their specs?

2010-11-08 Thread Anthony Smith
My thought is that it verifies you're receiving the error you expected and not an artifact from another issue. So my intention is not to test Rails but to make sure my tests are doing what I'm expecting. Does that make sense or am I just paranoid? On Nov 8, 2010, at 6:14 PM, Marnen Laibow-Koser

Re: [Rails] Does anyone test errors in their specs?

2010-11-08 Thread David Kahn
On Mon, Nov 8, 2010 at 5:01 PM, Anthony Smith wrote: > For example: > > it 'should not validate if nil' do > @account.name = nil > @account.should_not be_valid > @account.errors[:name][0].should eq 'can\'t be blank' > end > I do - my discipline is whenever I am modifying a model I

[Rails] Re: Does anyone test errors in their specs?

2010-11-08 Thread Marnen Laibow-Koser
Anthony Smith wrote in post #960202: > For example: > > it 'should not validate if nil' do > @account.name = nil > @account.should_not be_valid Those two lines are good practice: you're testing that the object is invalid when you want it to be. > @account.errors[:name][0].shoul

[Rails] Does anyone test errors in their specs?

2010-11-08 Thread Anthony Smith
For example: it 'should not validate if nil' do @account.name = nil @account.should_not be_valid @account.errors[:name][0].should eq 'can\'t be blank' end Is this good practice? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"

Re: [Rails] Re: Very good offer for ruby/rails developers

2010-11-08 Thread Michael Pavling
On 8 November 2010 20:50, Frederick Cheung wrote: > On Nov 8, 8:43 pm, Xdmx Xdmx wrote: >> Hi guys, sorry the "spam", > > would have been less spammy if that link to appsumo.com didn't have > what looks like a referral code embedded in it. haha! yes... http://tinyurl.com/35adxnv : 19 characte

[Rails] Re: Very good offer for ruby/rails developers

2010-11-08 Thread Frederick Cheung
On Nov 8, 8:43 pm, Xdmx Xdmx wrote: > Hi guys, sorry the "spam", but I've just seen that there is a very good > offer for us (ie. months of newrelic, sendgrid, heroku, linode and other > cool services). You can check more here:http://tinyurl.com/35adxnv > Hope that's useful for someone (I've jus

[Rails] Very good offer for ruby/rails developers

2010-11-08 Thread Xdmx Xdmx
Hi guys, sorry the "spam", but I've just seen that there is a very good offer for us (ie. months of newrelic, sendgrid, heroku, linode and other cool services). You can check more here: http://tinyurl.com/35adxnv Hope that's useful for someone (I've just took it) -- Posted via http://www.ruby-for

[Rails] Re: Access Denied for mongrel_service

2010-11-08 Thread LinhMai
You can try to run the command line as an Administrator. I had the same problem when running on Windows 7 Linh Mai. On Nov 5, 1:33 am, Anand Srinivasan wrote: > Hi there, > > When using the mongrel_service in windows, I am getting an Access Denied > error. I can understand that this is because o

[Rails] Re: having trouble accessing a nested resource in rails 2.3.5

2010-11-08 Thread Jeff
I believe your problem is this: Blog.comments.all You want comments on a specific blog, so you need this instead: @blog = Blog.find(params[:id]) @comments = @blog.comments Hope this helps. Jeff purpleworkshops.com On Nov 7, 2:56 pm, aperture science wrote: > I am trying to add comments to m

[Rails] Re: Optimization on huge generating xml?

2010-11-08 Thread chris
On Nov 7, 10:57 pm, Samnang wrote: > Do you any ideas on how to optimize this problem? Does it need to be XML? JSON is much lighter and faster. You can also use page caching with REST, so subsequent request is just like Apache serving flat file. Maybe try to use some sort of compression too?

Re: [Rails] Rails3 File open method

2010-11-08 Thread Brian Troutwine
If /public/ is an absolute path on your file-system, you can use the standard Ruby File methods. If /public/ must be relative to your app, use the standard File methods relative to Rails.root. On Mon, Nov 8, 2010 at 10:13 AM, Pradeep Achuthan wrote: > Hi, > > I have upgraded from rails 2 to rails

[Rails] Re: choose one of N: single form or multiple forms?

2010-11-08 Thread Fearless Fool
@phillip: thanks for the suggestions. Upon reflection, since the Google geocoder is already set up for client-side javascript queries, that's probably the best way to go. - ff -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Group

Re: [Rails] Open application services as API

2010-11-08 Thread Brian Troutwine
Hello, Without a few more details it's hard to say, so I'll make some assumptions: * You have token based authentication. * Your controllers and routes are already setup in a RESTful pattern. * Serializing your models is not a big deal. If these assumptions hold, all you need to is follow the pa

Re: [Rails] Optimization on huge generating xml?

2010-11-08 Thread Jeffrey L. Taylor
Quoting Samnang : > Hi all, > > Currently, I'm developing a rails app that are heavy generating xml > from restful webservice. My xml representation of web service use > nokogiri gem to generates xml format that match expected format from > client. But the problem is data is quite big around 50, 0

[Rails] Re: Rails Date MySQL operational differences

2010-11-08 Thread Robert Walker
bertly_the_coder wrote in post #960002: > I have been working with a couple of date operations in rails and my > answers have been pretty consistently inconsistent. I am a bit puzzled > about the difference between: > 1) days_stat = user.daily_stats.where({:day => dte.midnight.. > (dte.midnight + 1

[Rails] Re: get server address (rails server)

2010-11-08 Thread Carlos León
Answering the question #1 you can achieve this using the request.env[ 'HTTP_HOST' ] variable, that will return you a string with the hostname and the listening port, something like 'localhost:8080'. For the second one, I guess you could create like some constants for storing those keys of your n

[Rails] Re: Unable to use ruby-debug

2010-11-08 Thread Icenine Jon
That did the trick! I just converted over to Rails 3 so I wasn't aware of the Gemfile requirement. smbepiec, thanks for the suggestion -- it will come in handy when I update to Ruby 1.9.2. Arzumy MD wrote in post #960061: > In Rails 3 you need to include the gem in Gemfile > > gem 'ruby-debug' >

[Rails] Re: Re: Re: SOT MySQL index question

2010-11-08 Thread Marnen Laibow-Koser
Jeffrey L. Taylor wrote in post #960038: > Quoting Marnen Laibow-Koser : >> > of >> >> Composite *primary keys* are not (but there's a plugin). Composite >> *indices* are. You can specify multiple columns in add_index. >> > > Sorry I left out a constraint that turned out to be critical. This is

[Rails] Re: Rollback error message

2010-11-08 Thread Steve Alex
pepe wrote in post #960118: > > I am guessing that you are planning on using later on the message that > you are raising. Why not just add the error to your memo object errors > and then check in your controller if your memo.errors is empty or not? > > pepe Thanks for both suggestion. Again, first

[Rails] Rails3 File open method

2010-11-08 Thread Pradeep Achuthan
Hi, I have upgraded from rails 2 to rails3... I wanted to know to know how to open a file and write it in a location for eg.. i need to save a image in /public/imag...@imagename.. Please help me. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribe

[Rails] Re: REXML UTF-16 trouble

2010-11-08 Thread Naren Salem
Was this ever solved? How do I load a UTF-16 xml file into REXML? Thanks! Naren -- 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...@googlegroup

Re: [Rails] API Google MAPS

2010-11-08 Thread smbepiec
On 08/11/10 14:44, h0bit wrote: //document.getElementById("Longitud").innerHTML = marker.getPosition().lng(); //document.getElementById("Latitud").innerHTML = marker.getPosition().lat(); I think you just have to uncomment these lines and add some html like: Longitude:

[Rails] Re: why is migration failing?

2010-11-08 Thread Andola Soft
My advice to you is to use mysql instead of sqlite and see the results as it is a sample app. If not, try to be a little through about sqlite before using. moreover mysql and postgre are widely used DBs and will help you in future. -- Posted via http://www.ruby-forum.com/. -- You received th

[Rails] Re: Optimization on huge generating xml?

2010-11-08 Thread Andola Soft
With the kind of equation you are providing i.e. you have huge records to access, it will be better if you perform the 'pure sql query' to test. it might be a rare practice for others to test and testify. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are s

[Rails] Re: Displaying a form

2010-11-08 Thread Tim Shaffer
On Nov 7, 1:52 pm, Kellsborojack wrote: > So what I'm trying to do is once the link is clicked, the relevant > form is displayed in the .box div rather than on a new page. I think the simplest way would be to just output all the HTML on the page, then just hide or show the proper divs using JavaS

[Rails] Re: Rollback error message

2010-11-08 Thread pepe
> def create_memo >   #does stuff and if there is an error not in validations >   ... >   raise ActiveRecord::Rollback, 'Memo was NOT created. Payment exceeds > balance due' >   ... > end > Steve I am guessing that you are planning on using later on the message that you are raising. Why not just a

[Rails] Open application services as API

2010-11-08 Thread Mike Disuza
Hi, We have developed an application which is running fine. Our next step is to open our application services as the RESTFUL API for other applications. Can anyone tell me how could I proceed to this? Thanks, Mike -- Posted via http://www.ruby-forum.com/. -- You received this message because

Re: [Rails] Unable to use ruby-debug

2010-11-08 Thread smbepiec
If you're using ruby1.9.2 try: group :development, :test do gem 'ruby-debug19', :require => "ruby-debug" end in your Gemfile. I'd imply you should update to Rails 3.0.1 because of a security-update for nested attributes (if you use 'em). On 08/11/10 01:52, Icenine Jon wrote: I'm trying

Re: [Rails] Re: Re: Webrick Failing with Illegal Instruction

2010-11-08 Thread Walter Lee Davis
That may indeed be the new Rails 3 syntax, I haven't spent any time with that yet, so sorry if I led you astray. But I suspect your problems began when you used the plural name for your scaffold argument. Try again, using rails g scaffold_controller Lesson and see if there is a different ou

Re: [Rails] Nifty_generators problem

2010-11-08 Thread Jatin kumar
Yes. WIth Rails3 on the way, the usual nifty-generators now work with a " : " instead of " _ ". So, nifty_layout becomes nifty:layout, so does with nifty:authentication and nifty:scaffold. On Sun, Nov 7, 2010 at 7:18 AM, Ainar Abramovich wrote: > Gemfile: > gem 'nifty-generators' > > Terminal >

[Rails] Re: having trouble accessing a nested resource in rails 2.3.5

2010-11-08 Thread aperture science
I managed to make it work well enough. I put the following into the blog controller: def show @blog = Blog.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @blog

[Rails] Re: how to install ror on windows 7

2010-11-08 Thread romeo rap
On Nov 6, 7:36 am, venkata reddy wrote: > Hi all, > i want to learn ruby on rails.i am using window7  . > I installed  ruby 1.9.2 p0 in "C:\ruby"   using one click > installer.and then installed > rails using the command "gem install rails". and rails get installed > successfully. After that i t

[Rails] Need help with starting the server please

2010-11-08 Thread romeo rap
Hello, i got the missing sqlite3.dll error, i fixed it with downloading and placing both the .dll and the .exe in system32 and Ruby192\bin but now i get the error "The procedure entry point sqlite3_backup_finish could not be loacated in the dynamic link library Sqlite3.dll" I want to run it on

[Rails] Rails3: "rake test" task does not run tests.

2010-11-08 Thread troutwine
Hello all, I have a spiffy new rails3 app for which I can run tests individually, but not via rake. Behold! > $ ruby -Itest test/unit/test_user.rb > Loaded suite test/unit/test_user > Started > . > Finished in 0.466033 seconds. > > 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips > > Test run

[Rails] Displaying a form

2010-11-08 Thread Kellsborojack
I am using Rails 3.0.1 with Devise for user authentication. I am trying Rails out so if the answer is blindingly obvious please bear with me. I have an index page, which has links to the sign up/sign in forms. All the logic works fine but what I can't work out is how to display the forms in the in

[Rails] Re: Optimization on huge generating xml?

2010-11-08 Thread Frederick Cheung
On Nov 8, 3:57 am, Samnang wrote: > Hi all, > > Currently, I'm developing a rails app that are heavy generating xml > from restful webservice. My xml representation of web service use > nokogiri gem to generates xml format that match expected format from > client. But the problem is data is quit

[Rails] Re: Unable to use ruby-debug

2010-11-08 Thread Arzumy MD
In Rails 3 you need to include the gem in Gemfile gem 'ruby-debug' Cheers! Arzumy On Nov 8, 8:52 am, Icenine Jon wrote: > I'm trying to use ruby-debug but when I try to start the server with it, > I get an error saying I need to install it (even though it's installed): > > tiberius:project Jona

Re: [Rails] Re: how to build a smaple application using ror

2010-11-08 Thread rajeevsharma86
if you are okey with mysql as database go and start with instant rails On Sat, Nov 6, 2010 at 6:26 PM, Dani Dani wrote: > venkata reddy wrote in post #959648: > > Hi all, > after entering this command i got an error like " the program cont > > start because sqlite3.dll is missing from your co