I have a searchlogic that searches for not_null on an association that can occur many times, but I only want to display one UNIQUE/DISTINCT instance of the object:
Company.contact_emails_id_not_null
I only want one Company, no matter how many contact_emails are associated to that Company :through => :contacts
...
I am using scss with haml in my rails3 project. I mistakenly typed
zindex: 99999
instead of
z-index: 9999
SCSS did not blow up.
I thought one of the benefits of using haml/sass/scss was not invalid css values are not allowed.
...
Hi,
Is there a technique that I can use in Rails so that whenever a simple "find" is performed on a Model object, memcached is first searched for the result, only if no result is found will a query by then made to the database?
Ideally, I'd like the solution to be implicit, so that I can just write Model.find(id), it first checks the c...
Hello All,
So, I'm attempting to integrate Yahoo! into my Rails application as an OpenID provider and I'm having some trouble. I asked this question on Stack Overflow already, but it's not exactly the same question. I've already asked my current question here on RailsForum, but it hasn't gotten answered yet so I thought I'd repost it he...
I'm trying to use the Steam Condenser library with Ruby 1.9.2 and Rails 3.
I have the following code:
require "steam/servers/source_server"
class HomeController < ApplicationController
def index
server = SourceServer.new(IPAddr.new("127.0.0.1"), 2000)
server.init
@m = server.get_players
end
end
but for some reason...
I want to do the equivalent of (A<y AND B>x) OR (C < y AND D>x). how can i do that?
Right now, I am creating separate queries:
@companies_with_email = Company.contact_emails_date_sent_gt(@monday).
contact_emails_date_sent_lt(@friday).
find(:all, :select => "distinct companie...
This is what I have in my view:
<%= link_to_remote "Responded - Positive",
:url => contact_path(@contact, :status => 'positive response'),
:update => "status" %>
This is what I have as a route:
map.resources :contacts, :has_one => :status_contact
Here is what I used in my controller:
def create
@status_contac...
I am attempting to model a table tennis match in rails. Here is what I have:
Game Model:
team_1_score
team_2_score
team_1_id
team_2_id
Team Model:
game_id
player_id
Player Model:
Name
So each game will consist of 2 teams (of either 1 or 2 players each).
Then I was planning on linking game to player with has_many, :through. I don'...
Hi,
I am interested in building web applications using Ruby on Rails. I surfed the Internet and found out that I need to have a prior knowledge of the Ruby language. So can you please suggest some good books, online resources to start off with Ruby first and then Ruby on Rails?
Thanks,
Rakesh.
...
I have a flash_helper that I inconveniently downloaded from some web tutorial, which is now coming back to whack me on the head. On the good side, I'm sure the many talented coders here will find this easy. :)
# application_helper
def flash_helper
[:notice, :warning, :message].map { |f| content_tag(:div, flash[f], :class => f) if flash[...
Hi,
I am working on Ubuntu 10.04 and I am using feed-zirra to parse RSS feeds and I have MySQL database.
I am trying to parse RSS feeds from Times of India Top Stories. There seems to be problem with the first link, I am sure TOI guys will correct it soon. But anyway, I dont want to face similar error later so thats why I want to ask ...
Hi,
I am a newbie to rails and I have been watching Rails Casts videos.
I am interested to know a little bit more on FeedZirra (Rails casts episode 168) and especially feed parsing.
For example, I need to Parse feeds from Telegraph and Guardian
I want to put all the sports news from both the newspapers in one table, just football new...
Hi there!
I have website w1 written in rails using auhtlogic for authentication and w2 in PHP(say), I want w2 to access session information stored by w2 and login user into w2 and also retrieve user_id from session.
...
I have my own password/login rules that I want to implement such as:
Password: At least one number, one lower case character and one upper case character
Login: Alphanumeric and between 4 and 15 characters long
etc...
Currently when I do not enter a password and login in my form, I get the following errors (from Authlogic's default ...
I have a Rails application which need to run under SSL. I tried ssl_requirement but seems I have to type in all the actions in every controllers.
Is there any method that I can add a before_filter in application controller with ssl_requirement, so that the apps will redirect to https automatically when user request is in http?
Thanks a...
I'm setting up an after_save callback in my model observer to send a notification only if the model's published attribute was changed from false to true. Since methods such as changed? are only useful before the model is saved, the way I'm currently (and unsuccessfully) trying to do so is as follows:
def before_save(blog)
@og_publishe...
Hi,
I have articles and categories in a n:m relation:
I looking for a find statement on the Category Model so that I can get all categories witch consist at least one article.
Should be easy, but I didn't find a efficient solution, without searching retrieving all the articles.
Thanks,
Maechi
...
In the documentation for Rails::Plugin (for Rails 3), I'm reading the following:
"... you actually cannot declare a Rails::Engine inside your Plugin, otherwise it would cause the same files to be loaded twice. This means that if you want to ship an Engine as gem it cannot be used as plugin and vice-versa."
Can anyone be more specific a...
Hi,
I am building a social network from the ground up in rails and I am wanting to set up a face-book style notification system for displaying new messages, friend requests, etc... in a visual appealing and UI friendly manner. What's the best way to go about this? I am thinking of using acts_as_state_machine but it seems a bit out of da...
Dear All,
View
<form align="center" name="gm" action="">
<label for="col1"><b>Name: </b></label>
<%= collection_select(@table, "gm", @pop1, "col1", "col1", :prompt => true) %>
<%= submit_tag value="Proceed-->"%>
<form name="sp" action="">
<label for="col2"><b>Class: </b></label>
<%= collection_select(@table, "sp", @pop2, "col...