I have an Account model that belongs to an account manager:
class Account < ActiveRecord::Base
belongs_to :account_manager, :class_name => 'User'
validates_presence_of :account_manager
end
My controller looks like this:
def create
@account = Account.new(params[:account])
...
A request looks like this:
Started POST "/acco...
Working on a Rails project and the client wants files and the database to be deployed in-house. We are working with Heroku, which doesn't have a write interface and the application allows users to upload documents.
The database shouldn't be a problem, but original intention was to host files with Amazon. That isn't an option now and so ...
On our servers we have deployed multiple Rails applications using Phusion Passenger. Each application has a set of tasks that must be scheduled and run periodically (the usual clear caches, send mail, etc.)
All the examples I've seen in the wild usually show a separate daemon that handles the scheduled tasks for an application. However,...
ok, rails 3 new developer here.
I want my jquery to be able to get a json object from the rails 3 application for projects. Here is my controller.
def yourprojects
@projects = Projects.all(current_user)
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @projects }
end
end
I added the fo...
Hello,
I am making my first test on heroku and I have problem with the heroku db:push.
my config :
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.8.0]
gem 1.3.7
Is someone can help me ?
$ heroku db:push
Loaded Taps v0.3.12
Auto-detected local database: mysql://root@localhost/siftest?encoding=utf8
Warning: Data in the app 'mo...
Do you folks know of a rails chat room package that fulfills these criterion?
customizable
very simple with no bells and whistles
I am building a software with a chat component, and I was wondering if you folks had any idea there!
...
The following line works fine in MySQL, but in Postgresql I get a Rails error stating, "can't convert Fixnum to String".
viewable.update_attribute(:total_views, viewable.total_views.to_i + 1)
total_views is an integer field
Shouldn't Rails know to treat total_views as an integer even if I am using Postgresql?
...
I am using this gem, which is just a wrapper for the facebook graph API. I trying trying to post something to the logged in users facebook wall. This task seems easy enough but i am having these problems
graph = HyperGraph.new("some token").get('me')
=> {:last_name=>"Jones", :updated_time=>Fri Aug 06 22:27:03 -0400 2010, :email=>"jones1...
I have a nested resource in my routes.rb like this:
map.resources :users, :only => [:index] do |user|
user.resources :projects
end
which gives me URLs like /users/2/projects, which will show all projects owned by user 2. After a user is signed in, I'd like this to be the root page, using map.root. How would I set map.root to enable ...
how to run different versions of rails like 3.0 and 2.3.5?
...
I'll say right off the bat that I'm a complete beginner to Rails, so this might be something obvious that I'm missing.
I have a web form for editing an unordered (<ul>) list of questions. Each question is an item in the list. Each question has a text field for the question text and a dropdown to indicate what type of question it is (mul...
I am trying to geocode a batch of around 400 addresses using the Google Geocoding API through my rails app.
In one of my controllers I have these lines
require "net/http"
require "uri"
uri = URI.parse("http://maps.googleapis.com/maps/api/geocode/json?")
response = Net::HTTP.post_form(uri, {"address" => '5032-forbes-ave', 'sensor' => '...
I get the exact result I want if I change...
def index
@listings = Listing.all
end
to...
def index
@listings = Listing.where("general_use == 'Industrial'")
end
... in listings_controller.rb
The Listings index view shows a list of all Listings where the general_use field contains the word Industrial. However, I can no longer use...
Rails 3 app.... I have the following jQuery which is working:
$.ajax({
url: '/navigations/sidenav',
data: "urlpath=" + urlpath,
success: function(e){
$("#sideNav-container").slideDown("slow");
}
});
urlpath can be paths like '/' or '/projects' or '/authors' stuff like that.
My question is how do I grab that ur...
Hello, i have a variable like /projects/3/blah blah or /projects/3 or just /projects
What I'd like to do is have an IF statement in Rails like this:
IF urlPath contains /projects proceed
Does Rails / Ruby have a method for that? Also, likely it shouldn't have a false positive for something like /books/projects or /authors/mr-projects/...
I have an Admin controller for a page of a Rails 3 app that lists all the User model accounts in a table, and part of each row should be a link (with confirmation) to toggle the is_admin attribute of my User model. I would like to do this by allowing an admin to click on text in the table cell that lists the current admin status (i.e. cl...
I am running Rails 3 configured to use memcached for session store. I have the following setup:
development.rb
config.cache_store = :mem_cache_store
session_store.rb
Foo::Application.config.session_store :mem_cache_store, :key => '_foo_session'
I can start the app fine, when I go to any page I get the following error:
ArgumentError...
In Rails (3.0) test code, I've cloned an object so I can clobber it for validation testing without changing the original. If I have called assert(original.valid?) before cloning, then the clone passes the validates_presence_of test even after I have set member_id value to nil.
The two tests below illustrate this. In test one, the clone...
Given a Rails 3 App with a menu like:
<ul>
<li>Home</li>
<li>Books</li>
<li>Pages</li>
</ul>
What is a smart way in Rails to have the app know the breadcrumb,,, or when to make one of the LIs show as:
<li class="active">Books</li>
thx
...
Hello, I couldn't find Rails3 bundle for Textmate.
I looked at their website (as well as their github).
I couldn't find any!!
THanks!
Adam
...