Hi,
I am using Netbeans 6.5.1(on windows) for rails. I am trying to add new plugins from the rails console like for example
ruby script/plugin install svn://svn.seesaw.it/tabnav
But this pops the foll error :
(irb):1: syntax error, unexpected tIDENTIFIER, expecting kDO or '{' or '('
ruby script/plugin install svn://svn.s...
I'm using acts_as_taggable_on and I'm trying to query for all users tagged with any of the tags in the collection tags
Right now I'm doing:
tags.map(&:name).each { |name| @result.push User.tagged_with(name) }
Is there a way that I can do this in one query, and not tags.size queries? I'd appreciate any help.
...
Right now I'm building a social media app, where i want an user to have a rating per category, how would the association go? The way it needs to be setup it's Each user will have a different rating in each category.
I'm think that
belongs_to :user
belongs_to :category
in the UserCategoryRating model.
and
has_many :user_category_r...
Hi, I'd like to generate a form with nested object forms like this (in haml):
- form_for @parent do |parent_form|
- parent_form.fields_for :children do |child_form|
= child_form.label :first_name
= child_form.text_field :first_name
... and I'd like to place the child forms in a jquery ui (1.8.2) accordion, like this (I think...
I use Rails RESTful routing to generate URLs for one resource in my application. My resource ID contains some special characters. The confusing part is that in the generated URL, when I look in the HTML, is double escaped. For instance, /item/item+one get escaped to /item/item%252Bone instead of /item/item%2Bone.
When getting the ID par...
So I just deployed my first rails app (using passenger) and I have set - RailsEnv test
I was looking at the test.log and its empty. So I have a few questions on rails logs -
I don't see development like logs in test.log - things like details of request & SQL etc
Okay may be test != development, that why??
Also, I tried this in my c...
I'm new to Rails and trying to create a has_and_belongs_to_many relationship between orders and items.
class Order < ActiveRecord::Base
has_and_belongs_to_many :items
end
class Item < ActiveRecord::Base
has_and_belongs_to_many :orders
end
Migration for Orders (not shown. very basic)
Migration for OrderItems:
class CreateItems ...
Let's say I have two models Post and Category:
class Post < ActiveRecord::Base
belongs_to :category
end
class Category < ActiveRecord::Base
has_many :posts
end
Is there a method that will allow me to do something like
posts = Post.find(:all)
p = Array.new
p[1] = posts.with_category_id(1)
p[2] = posts.with_category_id(2)
p[3] =...
there is a limit of 2400 geocoding request for google service. even if each request is cached and not duplicated its possible to exceed this limit if the request is being made from a rails app.
short of purchasing the premium package(which i dont know the cost of), what else can one do?
thanks
...
Hi
How can I add multiple objects in a find condition?
I created a table for comment but I want to display comments posted by a user and
His or her friends.
I got the find method to return a list of comments by a users friends but I cannot get the
Find method to include the user as well.
For example
User = profile.find(1)
Comment.fi...
What parts of Rails have you used even when you're not building a web site or web services?
For example, some people use ActiveRecord by itself.
...
Can you guys please recommend few textmate bundles that would be helpful while developing ruby on rails applications
...
I'm having trouble with the Dynamic attribute-based finders in rails. They don't seem to exits for my model.
class Person < ActiveRecord::Base
belongs_to :team
end
class Team < ActiveRecord::Base
has_many :people
end
So in script/console, to find the teams having person with ID 1, I should be able to do:
>> Team.find_by_person...
Is it possible to define custom configuration in config/environments/*.rb or config/environment.rb file.
Is yes, how do i access them from my code (controller, model, library, helper)
Thanks.
...
My home page is largely the same for all users, which makes it a candidate for page caching. however, there are a couple of things that are user specific. For example, there is a nav item that is only shown for logged in users and there is a link like logout, my profile etc, generated for specific users.
Do I have to use fragment cachi...
I have some very large mp3's stored at a remote location and I presently link to them like so:
= link_to "mp3", "http://website-where-file-is-stored.com/file-123456.mp3"
When a user clicks the link, the file starts to play in the browser. I would like the file to download to the users hard-drive after they click the link.
I've read a...
I use gem install rails -v=2.3.8 to install rails, and it says rdoc and ri has been generated.
But when I gem server, I can't open the rails doc in browser, it says doc_root/rails-2.3.8/rdoc/index.html not found
I looked into /usr/local/lib/ruby/gems/1.8/doc/rails-2.3.8/rdoc, found it is empty.
How to fix it? How to generate the rdoc ...
I have two types of classes:
BaseUser < ActiveRecord::Base
and
User < BaseUser
which acts_as_authentic using Authlogic's authentication system. This inheritance is implemented using Single Table Inheritance
If a new user registers, I register him as a User. However, if I already have a BaseUser with the same email, I'd like to ...
There are two classes:
class Person
include Mongoid::Document
field :name
embeds_many :addresses
end
class Address
include Mongoid::Document
field :city
field :street
validates_presence_of :city, :street
end
We can see, we have validated the city and street should be present.
But see following code:
person = Person...
I'm running a Rails app on an ubuntu hardy box with passenger. I also have a couple basic html sites running on the same box. My problem is that the apache vhost set up for the html sites seems to be blocking my Rails app from resolving at the proper url.
I have a number of Rails apps running on different slices using passenger, so I ...