I am trying to do a
$heroku db:push
this is the error I get
C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138:in `union': can't convert Array into
String (TypeError)
from C:/Ruby/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in ...
I very often want to use dynamic finders to specify NOT NULL. So…
this works:
Widget.find_all_by_color('blue')
this works:
Widget.find_all_by_color(nil)
But how can I do
SELECT * FROM `widgets` WHERE `color` IS NOT NULL;
?
...
Hello, I am trying to implement a gem called stanfordparser which can be found here: http://stanfordparser.rubyforge.org/
It is a ruby wrapper for a java natural language parser
I am developing in netbeans using ruby on rails / jruby on a windows 7 machine. My web app works fine otherwise, but when I try to add the parser wrapper it br...
I created an array using this statement..
users_who_promoted = @organization.card_signups.select {|c| c.credit_status == true }
but when I do this :
users_who_promoted.update_all("credit_status = false")
I get a big error :
NoMethodError: undefined method `update_all' for #<Array:0x32377bc>
from (irb):25
Why is this?
...
Is there some sort of short hand for
@notifications = Notification.find(:all, :conditions => ['expires_at > ?', Time.now])
notif = Notification.find(:all, cookie[0].to_i)
@notifications.delete(notif[0]) if not notif.empty?
cookie is an id of a notification stored into cookies.
this is in an iteration, that removes notifications ...
I'm working on a Rails application that allows users to define Tasks, which require a due_date. The due_date may or may not include a time.
The way we're handling this right now feels like a hack. due_dates default to 12:00 AM, and in that case we don't display a time. The DateTime object doesn't allow for empty Time values as far as I ...
Here is my one model..
CardSignup.rb
def credit_status_on_create
Organization.find(self.organization_id).update_credits
end
And here's my other model. As you can see what I wrote here is an incorrect way to pass the var
def update_credits
@organization = Organization.find(params[:id])
credit_count = @organization.card_signup...
Hi,
Following is a test case in RailsTutorial. Generally I understand the syntax, But in this case, they define the @invalid_attr variable, but they dont seem to be using it. Infact in this line @user.should_receive(:update_attributes).and_return(false), I think @user would have all the values from the factory, rather than @inva...
I'd like to do something like acts_as_list, but in two dimensions, to define a position in a grid. Does this exists anywhere already? Any tips for how to get started?
...
I'm using Liquid markup in a Rails project that I'm working on, and I'm trying to create a link_to filter.
I'd like to be able to generate templates such as the following:
<ul>
{% for page in edition.pages %}
<li>{{page | link_to_page}}</li>
{% endfor %}
</ul>
Where I could use polymorphic routes to generate the link based on t...
Hello,
I've been using Chronic, the natural language parser and its awesome. The problem I'm running into now is I cant parse the military time its give me back in to some form of AM/PM time that would be normal for a user to see.
<%= Chronic.parse("next monday") %>
yields => Mon Jul 05 12:00:00 -0500 2010
Is there a way to go b...
Hello, I wanted to create some basic html pages to add to my rails app.
I figured the restful way to do it would be to create a controller. The problem is I'd like the pages to be a two word title. => ex. www.mydomain.com/foo-bar/
For SEO reasons it really must be two words, and I need the separation...using www.mydomain.com/foobar...
The following code works fine as long as I don't try to run it through the distributed server. It doesn't get there...
It runs fine out of delayed_job, runs fine if called directly.
But if 'distrib' is true (the default) it runs right up to the call to the server and right past it without getting to the server or raising any errors.
Am...
What's the proper way to write?
validates_uniqueness_of :a, :scope => [:b, :c], :unless => !d.nil?
...
I have implemented David Heinemeier Hansson's article in "Advanced Rails Recipes" called Toggling Attributes with AJAX. I have a question about implementing this fantastic recipe in a more general setting.
Hansson's tutorial works when toggling only one type of attribute in one view because the spinner image is named: 'spinner-#{object....
I have an application in which I need to implement the faceted search functionality on one of the fields of the associated models and it does not seem to be working. Here is a brief context:
There are 3 models I am working on: 1. Product 2. Attributes 3. ProductAttributes. Please see the code spnippets below:
class Product < ActiveReco...
I'm trying to add functionality to a project done in ruby, I'm unfamiliar with Ruby, but have managed to create a project review page that allows updates on the project task codes for a given monthly review.
My issue is that the client (my brother) has asked me to allow him to edit the scheduled hours for the next few months on "this"...
I have a form for editing profiles. Rails automatically generates the form id as 'edit_profile_##' where ## is the profile id of the current user(instance variable-@profile_id). I need to use this form id for my javascript functions. Is there a way to get the current user's profile id inside js? Or is there a way I can override the autom...
I have a slightly complex navigational system with numerous landing pages, multipage forms, and multiple ways of accessing the standard CRUD functions.
Objective: To maintain a variable such as (params[:target]) throughout the system such that each controller knows where to redirect a user based on the location and circumstances of the ...
I am trying to create a site in RoR and have enabled caching for some pages and actions. The related DB may not accessible every time and hence using the cache is very much required. Hence I cant wait for someone to actually visit the page, render it and then cache it. Instead I want whatever is cache-able to be cached manually, programa...