Struggling with this one a little bit. I have two parameter search form, when both fields match it returns the row into @person:
So what i want to happen is render one partial before the search, another one if a person is matched and another one if a record is not found.
Where does this logic go and what can I check against?
def inde...
Hello.
I've written the admin area of a particular rails app and now I'm ready to set it as own section within the website.
Therefore, it will be /admin
However, I didn't want to have it as /admin within the route itself I wanted to have something less common, so I added a couple of hyphens before and after it.
So the route is /-admi...
I have been trying to install rails on IIS 7. I have been following guide here. However, after installing rails, I create a new rails app and there is no "dispatch.fcgi" in the public directory of the app. I assume that I am doing something wrong on the install of the rails gem or missing a dependency. Any help would be appreciated
...
How ActionController instance variable @test="123" is accessible in ActionView? Similarly how helper method is available in ActionView? What's core architecture? What is the purpose of ActionPack?
...
Say i have this short code:
item = Item.find(params[:id])
render :json => item.to_json
but i needed to insert/push extra information to the returned json object, how do i do that?
Lets say i need to insert this extra info:
message : "it works"
Thanks.
...
What is the rails activerecord syntax for select records with an empty field? For example, I want to find all the records that the middle_name field is empty (length of the string < 1) for a user database. Thanks!
...
I've split my rails app into a admin directory and a public directory.
The admin directory is within an Admin:: namespace (/admin).
When I created a controller called Forums in both the Admin:: namespace and the normal root map area, the routing seems to find the Admin::Forums controller for /forums and /admin/forums.
So /admin/forums...
How can I redirect a misspelled url to some default url in case a user mistypes a url?
...
How can I translate this MySQL's WHERE to ActiveRecord :condition?
SELECT * FROM users WHERE LENGTH(users.last_name) < 3
Thanks!
...
I'd like to do a query where I select a bunch of data, but I'd like to be able to then decrease the resolution of that data by only selecting, say, every third record, or maybe even every hundredth record, or whatever.
Is there any straightforward way to do this with ActiveRecord?
...
Please help me get the include right.
Poem
has_many :awards
has_one :overall_ranking
Award
belongs_to :poem
# before
# has_one :overall_ranking, :foreign_key => :poem_id
## SOLUTION
# after
has_one :overall_ranking, :foreign_key => :poem_id, :primary_key => :poem_id
OverallRanking
belongs_to :poem
update: Award.a...
hi all
I am trying to work out the best way to store my daat using mongodb and mongomapper.
I have category and each category can be described by many attributes so length in mm, weight in kg etc.
I want each user to be able to create their own attributes to descibe a category of products.
So forexample:
user A wants to store his c...
What's the recommended way to do the following:
class Property
include MongoMapper::Document
key :key
key :value
belongs_to :post
end
class Post < ActiveRecord::Base
has_many :properties
end
Does that work (testing now)?
Update, adding this to ActiveRecord is a start:
ActiveRecord::Base.class_eval do
def new?
new_...
Hi there,
Can anybody show me (maybe copy/paste a simple code example) how to create the .pdf file from an existing (.xls) file, using the Prawn gem? (Basically, I'd need the command that "opens" the existing file.)
(I'm asking because the Prawn documentation (http://prawn.majesticseacreature.com/docs/) seems to be gone since quite a w...
PROBLEM:
I want to run a query which would trigger something like
select * from users where code in (1,2,4);
using a named_scope.
WHAT I TRIED:
This is for a single code:
named_scope :of_code, lambda {|code| {:conditions => ["code = ?", code]}}
I tried something like
named_scope :of_codes, lambda {|codes| {:conditions => ...
hi all
I have a category collection and each category has a array of hashes containing attributes names and units to create a inout form with, to add a product of that category.
for example category car fields - {name : length, unit : mm}, {name : weight, unit : kg}.
Problem is i would this site to be multi-lingual and therefore need ...
Hello there.
I need a bit help with dynamically generating column-based table instead of row-based table.
Let's say that I have a hospital and hospital has many patients.
Hospital no 1
| Day 1 | Day 2 | Day 3
Patient 1 | 36.6 | 36.4 | 36.5
Patient 2 | 37.0 | 37.1 | 36.6
Patient 3 | 37.1 | 36.4 | 36.7 ...
Hi,
the default directory scturture for my Rails 2.3.5 project is
public/stylesheets
public/javascripts
I don't like this structure, because my project is logically divided on set of smaller parts (components, each of them can be modified independently from anothers.
Also, to fully style the component, i use CSS + jQuery, so, cs...
I have implemented the full text search using Sphinx and Thinking Sphinx.
I want to add column wise search. Some thing like:-(taking an example of Stack Overflow)
Suppose you want to see actvities related to you, just type:
user:me
Then it will return a result with all the questions and answers related to piemesons.
If you type
...
Hey all,
I'm facing a problem with the deployment of my sites on my server.
What I want is to have a site hosted directly at the root and also at /site2.
Config now looks like this:
- /opt/dn/site1 contains Rails site 1 (so in here there's app, public etc)
- /opt/dn/site2 contains Rails site 2 (so also wtih app/public/...)
- /opt/dn/www ...