I'm creating a Rails app for students and high schools and I'm having some trouble with my User.rb.
I want to have a user model to be used for logging in, but having that user have many roles. The tricky part is that I want users that have a student role to have_one student page, and those that have a role of principal to have_one hi...
I'm trying to write a rails application where users can upload images, but Paperclip doesn't seem to be working for me.
I've gone through all the basic steps (added has_attached_file, the migration, making the form multipart) but I keep getting the same error whenever I try uploading an image:
can't convert nil into Integer
Lookin...
I have an nested model student that belongs to a high_school. The problem is that when I go to create a new student (/high_schools/1/students/new) I get this error:
No route matches {:action=>"destroy", :controller=>"students", :high_school_id=> # <HighSchool id: 1, name: "cool place", ... }
<%= form_for @student, :url => high_school_...
Is there some plan or estimate about how long will Rails 2 be supported after Rails 3 has been released?
I wanted to ride the wave and move to Rails 3 right away, specially for projects that may take 4 or 6 months to finish (so that they would probably be released with Rails 3.0.0 final) but I've found many things still not working, man...
i am trying to deploy rails3 apps with the latest phusion passenger 2.2.11 and ruby-enterprise-1.8.7-2010.01. i am using bundler, but passenger seems to not be able to find the .bundle dir.
error message:
git://github.com/rails/rails.git (at master) is not checked out. Please run `bundle install` (Bundler::PathError)
where do i insta...
i am getting a strange bundler error when running
bundle pack
with bundler 0.9.12
any ideas? (see pastie for a better formatted code: http://pastie.org/881328 )
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize': not in gzip format (Zlib::GzipFile::Error)
from /opt/ruby-ente...
i am wondering if the :with attribute is removed from rails3 since i cannot find anything in the rails3 api - http://rails3api.s3.amazonaws.com
anyone has a clue or give a hint on how to use the :with parameter to send data with a link_to
non-working example:
= link_to "Foo", {:action => "filter", :filter => "filter1",:with => "'test=...
Hello,
I have a thing blog application, and I would like to shorten my routes. Here there are:
Blog::Application.routes.draw do
resources :categories do
resources :articles do
resources :comments
end
end
A rake routes command build the following lines:
GET /categories/:category_id/art...
I'm just learning MongoDB and MongoMapper. This is on Rails 3.
I created a blog in app/models/blog.rb:
class Blog
include MongoMapper::Document
key :title, String, :required => true
key :body, Text
timestamps!
end
I go into the Rails console:
rails c
Loading development environment (Rails 3.0.0.beta)
ruby-1.9.1-p378 > b = ...
In Rails 2.x you can use validations to make sure you have a unique combined value like this:
validates_uniqueness_of :husband, :scope => :wife
In the corresponding migration it could look like this:
add_index :family, [:husband, :wife], :unique => true
This would make sure the husband/wife combination is unique in the database. No...
I'm using rails 3 and I can't seem to check if a given instance is in a scope, see here:
p = Post.find 6
+----+----------+-------------------------+-------------------------+-------------------------+-----------+
| id | title | publish_date | created_at | updated_at | published |
+----+----------+...
With Rails, If I have a variable with HTML content, how do I output it, unencoded in my view file?
This code, for example:
<% my_variable = "<b>Some Bolded Text</b>" %>
<%= my_variable %>
Outputs:
<b>Some Bolded Text</b>
...
I'm trying to put some specs around a new rails 3 project I am working on, and my first test doesn't seem to be able to find a model.
I've installed rspec from the command line using:
sudo gem install rspec --pre
and then I put the following in my Gemfile
gem "rspec-rails", ">= 2.0.0.beta.1"
But when I run my test I get
./spec/mo...
I'm wondering if anyone out there has worked with Google Maps API with Rails 3. I'm looking for launching ideas, gems, plugins etc.
I played around with ym4r-gm plugin for several hours today, with not much luck. Have you played with this API on rails 3 yet?
Thanks in advance!
...
By @user.posts, I can see there is a post with :unfinished status.
But @user.posts.where('status = ?', :unfinished).all returns an empty array.
I've tried to invoke @user.reload first, but it doesn't resolve the problem.
(rdb:568) @user.posts
[#<Post id: 1, content: "hehe", user_id: 1, created_at: "2010-04-03 06:16:47", updated_at: "2...
I have a Rails 3 app ready for staging.
I haven't got a VPS host set up yet. As I was planning to have everything on shared host for the first few months.
Problem:
cd myapp
bundle check
result:
The Gemfile's dependencies are satisfied
Passenger error:
Error message:
no such file to load -- bundler
Exception class:
LoadEr...
Hello SO.
I'm trying to make an API for my rails application using JSON responses to RESTful resource controllers. This is a new experience for me, so I'm looking for some guidance and pointers. To start things off:
In a rails application, what is the "proper" way to respond with JSON to REST-ful controller methods? (create, update, d...
I've setup Rspec2 beta5 and shoulda as following to use shoulda macros inside rspec model tests.
Gemfile
group :test do
gem "rspec", ">= 2.0.0.beta.4"
gem "rspec-rails", ">= 2.0.0.beta.4"
gem 'shoulda', :git => 'git://github.com/bmaddy/
shoulda.git'
gem "faker"
gem "machinist"
gem "pickle", :git => 'git:/...
I want to set default cookie domain for my application to ".mydomain.com" to allow cookie session be preserved across subdomains. There are many places showing how to do it in Rails 2.x but these solutions doesn't work for Rails3. Anyone know how can I set it?
...
So I am trying to use the rails3 branch of Nifty Generators by Ryan Bates. Now I've used this gem before with beta1 and its worked, but after upgrading to beta2 I've been getting a very wierd error.
lib/generators/nifty/scaffold/scaffold_generator.rb:35:in `block in initialize': uninitialized constant Rails::Generators::GeneratedAttrib...