[Rails] Re: Rails 3 Model Without Database

2011-02-25 Thread Arailsdemo A.
You should look into ActiveModel http://railscasts.com/episodes/219-active-model This will allow you to create model that has certain ActiveRecord like capabilities like validations without the need for a database. Look at the mail_form gem (https://github.com/plataformatec/mail_form/blob/master/

[Rails] Re: Rails 3 Flash Messages Not Clearing

2011-02-14 Thread Arailsdemo A.
Does using flash.now help? http://handyrailstips.com/tips/15-knowing-when-to-use-flash-now -- 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@

[Rails] Re: DRY in rspec tests

2011-02-13 Thread Arailsdemo A.
You can include helper modules in your spec_helper file: RSpec.configure do |config| config.include MySpec::SessionsHelper, :type => :controller, :example_group => { :file_path => config.escaped_path(%w[spec controllers]) } end This will include the MySpec::SessionsHelper in all of

[Rails] Re: RSpec / Cucumber painfully slow Rails 3 OSX

2011-01-23 Thread Arailsdemo A.
Try adding this to your spec_helper.rb Spork.each_run do require 'factory_girl_rails' end adam wrote in post #976883: > Strangely - I am not getting this error when running seperate > features, only when running just "cucucmber --drb" -- Posted via http://www.ruby-forum.com/. -- You receiv

[Rails] Re: RSpec / Cucumber painfully slow Rails 3 OSX

2011-01-21 Thread Arailsdemo A.
> But don't you always need to do that? Isn't that the task that clears > out the test DB? Or is that not an issue since you're (hopefully) > running your specs transactionally? As far as I can tell, the difference between 'rake spec' and 'rspec spec' is 'db:test:prepare'. When all tests pass w

[Rails] Re: RSpec / Cucumber painfully slow Rails 3 OSX

2011-01-20 Thread Arailsdemo A.
1) If your running 'rake spec', then don't, unless you need to do 'rake db:test:prepare' also. The 'rake spec' command combines the database rake with 'rspec spec', that's why it takes a few seconds before the tests are run. Use 'rspec spec' instead. 2) Use Spork and Autotest. Follow http://ra

[Rails] Re: Adaptive Learning for Ruby on Rails

2011-01-16 Thread Arailsdemo A.
It seems to me that it would be hard to target users with such a wide range of experiences (beginner to expert). I'm not familiar with adaptive learning techniques, but if I'm a moderate level user, I wouldn't want to sit through too much beginner level stuff to get through to the more advanced

[Rails] Re: Rails 3, RSpec, Factory Girl results in NameError: uninitialized constant

2011-01-16 Thread Arailsdemo A.
Did you create your VideoOne model yet? FactoryGirl requires that this be present. Here's some general background on FactoryGirl http://www.arailsdemo.com/posts/39. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby o

[Rails] Re: Learning Rails wth tutorial - can't push to Heroku

2011-01-15 Thread Arailsdemo A.
You can try installing the gem outside of Bundler. > gem install sqlite3-ruby or if you're not using RVM > sudo gem install sqlite3-ruby -- 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 pos

[Rails] Re: Learning Rails wth tutorial - can't push to Heroku

2011-01-15 Thread Arailsdemo A.
Try running 'bundle install' (or 'bundle' for short) from the command line and then repushing to Heroku. If that doesn't work, try 'bundle update'. Make sure you run bundle install anytime after changing your Gemfile. About Gemfile.lock: If you have gem 'rails' in your Gemf

[Rails] Re: Is this thing here a helper or a model, or something else?

2011-01-13 Thread Arailsdemo A.
If you haven't worked with the lib/ directory before, make sure you have config.autoload_paths += %W(#{config.root}/lib) in config/application.rb Also, if you ever want to make yourself a gem, you could do something like # lib/acts_as_chunky_time module ActsAsChunkyTime def self.inc

[Rails] Re: Please advise on render:partial form.

2011-01-13 Thread Arailsdemo A.
Looks like you have Casting has_many :comments, and you have a comment form on your Casting show page. If so, then you just need to render your casting show page. But this requires you to supply the Casting show page the @casting variable in your controller. ... else @casting = Casting.find(@

[Rails] Re: Is this thing here a helper or a model, or something else?

2011-01-13 Thread Arailsdemo A.
These methods are not generating any HTML, so they should not be in a view helper. Like you said, they are not needed for controller function, so they shouldn't be in the ApplicationController. So I would put them in your model. You can put this logic in a module in your lib/ directory. This way i

[Rails] Re: Strange error while using Authlogic

2010-11-21 Thread Arailsdemo A.
Uninitialized constant usually means that the the module hasn't been loaded into the Rails environment. Adding an initializer file might fix it, but it seems to me that this shouldn't be necessary with Authlogic. Make sure you're using the most updated version of Authlogic. # config/initialize

[Rails] Re: Pull tweets into application

2010-11-14 Thread Arailsdemo A.
Have you checked out the Twitter gem? https://github.com/jnunemaker/twitter To pull your tweets, you probably could just the Twitter::Search class. If you want to be able to make tweets from your app, then you'll have to go to dev.twitter.com to register you app with Twitter. Then you can take th

[Rails] Re: Argument error in controller # show

2010-11-13 Thread Arailsdemo A.
"e.g. ruby script/generate model ad name : string ," Did you put spaces between 'name' ':' and 'string'? If you did, take them out. > script/generate model ad name:string. If you don't know about http://railstutorial.org/book then you might want to check that out. -- Posted via http://www.ru

[Rails] Re: Rails show views from a different controller

2010-11-06 Thread Arailsdemo A.
You need to take the redirect_to out of the about_us action, and instead just set an instance variable that has the comments that you want to display. # app/controllers/pages_controller.rb class Pages < ApplicationController def about_us @comments = Comment.all end end Then all you nee

[Rails] Re: Inheritance alternative

2010-11-05 Thread Arailsdemo A.
How about just creating your own module and including that in your classes? # lib/common_methods.rb module CommonMethods def all_get_this_method ... end end app/models/company.rb require 'common_methods' class Company < Active::Record::Base include Commonmethods ... end config/appl

[Rails] Re: Delete action is not working and redirects to edit action

2010-11-04 Thread Arailsdemo A.
Oops. Correction on the above answer. It should be GET instead of POST. If there is no javascript, the delete link sends a get request to your server. A get request on an existing record gives you the edit action. -- Posted via http://www.ruby-forum.com/. -- You received this message because

[Rails] Re: Delete action is not working and redirects to edit action

2010-11-04 Thread Arailsdemo A.
Sounds like you don't have any javascript files in your Rails app. Remember that the destroy method uses javascript to work correctly. If javascript is missing, then the browser sends a POST request to your Rails server. If you send a post request to an existing record, you get the edit action

[Rails] Re: link_to in the controller flash message?

2010-11-01 Thread Arailsdemo A.
Did you include the module? class YourController < ApplicationController include ActionView::Helpers::SanitizeHelper Christian Fazzini wrote in post #958461: > Arailsdemo, I dont think the sanitize helper works in the controller > level. I get the error: undefined method `sanitize > > Marnen,

[Rails] Re: Amazon s3 - paperclip - Rails3 - basic setup Noob simple problems

2010-10-31 Thread Arailsdemo A.
I get that same "...open=false>" in my console when connecting to S3. Can you transfer a file through the console commands? See http://amazon.rubyforge.org/ Also, in the s3.yml file, do you have things in quotes? development: bucket: 'teneventsdevelopment' access_key_id: 'asdfa324234' secr

[Rails] Re: Amazon s3 - paperclip - Rails3 - basic setup Noob simple problems

2010-10-31 Thread Arailsdemo A.
1. The polymorphic part isn't necessary. If you just expect to have one model that has file attachments then it's not going to help you. However, if you have multiple models that have attachments, then you might want to go the polymorphic way. See http://guides.rubyonrails.org/association_basic

[Rails] Re: link_to in the controller flash message?

2010-10-30 Thread Arailsdemo A.
Try this class YourController < ApplicationController include ActionView::Helpers::SanitizeHelper def your_action redirect_to(:back, :notice => sanitize("Photo was successfully created. Click here to view it")) end end If you haven't used the sanitize method before, please read this ht

[Rails] Re: Amazon s3 - paperclip - Rails3 - basic setup simple problems

2010-10-30 Thread Arailsdemo A.
Did you set up your S3 bucket for your app? I wrote up how to do this set up here http://www.arailsdemo.com/posts/15 Hopefully that will get you going. Michael Baldock wrote in post #958147: > Thanks for the help Walter, I tried what you said, putting them in a > different order, still doesn't

[Rails] Re: Error messages for nested resource; guide says to use f.error_messages, but is deprecated/didn't

2010-10-30 Thread Arailsdemo A.
You want to set your comment variable in the controller: def new @comment = @post.comments.build end so your form is <%= form_for([...@post, @comment]) do |f| %> <%= render"shared/error_messages", :target => @comment %> <% end %> If you build the comment in the form (which you shouldn't be

[Rails] Re: Synatx highlighting in Ruby

2010-10-24 Thread Arailsdemo A.
Ryan Bates did an Railscast episode on syntax highlighting libraries (http://railscasts.com/episodes/207-syntax-highlighting). I am using CodeRay for my site. It was pretty straight forward to use. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribe