Take a look at haystack
If you click on $3,000 and under take a look at the url it will be:
"3000-under"
Assuming you're using Search Logic how would this be done in the routes?
For quick reference by default search logic suggests search[:params] which maps to a model field. For instance, Haystack's case: {:search => {:price_less_th...
Hello.
I want to know how to show a record only exactly after it was created. So i want to show it only once.
Just see. I have model called Claim. User creates new Claim (user is anonymous). I want to show this Claim only ofter user creates it and never again. How can I do it?
I think that I can use flash hash, but i think it is not e...
I have a a post model and a categories model
I want to show a list the all posts by category all on one page.
I am using has and belong_to in each model correctly.
I just cant fiqure out how to show them in my view.
Want I need is
Category Name
Post1
Post2
Post3
Category Name2
Post1
Post2
Post3
etc...
Thanks
...
Hi, I have a list of incorrect cities name in Philippines:
>> a = City.find_all_by_country_id(4)
=> [#<City id: 91, name: "Alaminos", country_id: 4, created_at: "2009-11-12 04:06:14", updated_at: "2009-11-12 04:06:14">, #<City id: 92, name: "Angeles", country_id: 4, created_at: "2009-11-12 04:06:14", ...
And I wanted to replace all t...
how can I convert html to word
thanks.
...
We want to build a app where we would like to show translated version of dynamic content as well. The transalted content would be uploaded by us (so we don't need any translation logic).
I was wondering if there any other gems to consider apart from the built-in i18n? i18n seems to be best for static data, but does not handle dynamic da...
(in /Users/sayedgamal/apps/test)
/Users/sayedgamal/apps/test/config/boot.rb:20:Warning: Gem::SourceIndex#search support for String patterns is deprecated
== CreatePeople: migrating ====================================================
-- create_table(:people)
rake aborted!
undefined method `string' for #<ActiveRecord::ConnectionAdapters::...
If I have some config for web admin to set e.g. number of post per page, some enum showing choice. How should I keep this settings in db ? Should I serialize it and save as blob.
Thanks,
I using rails and I want it to dynamically change this setting through web interface, so I think environment.rb would not fit this situation. So I s...
Im new to tdd and stubbing. When I stub a method im assumng that any code within that method does not get executed? Im trying to fake the method raising an exception but the results of my test indicate that the code in that method is being executed rather than bypassed.
can anyone help explain why?
My stubbing is
@logged_in_user.subs...
I am setting up a new Macbook as a rails development machine. Till now, I always installed ruby, MySQL, etc. through MacPorts, because I don't want to be dependent on the system version of ruby. But with stuff like Homebrew and rvm (no link because of spam prevention) popping up, is there a better recommended way of setting up ruby for r...
I have a couple of models which share a has_many associations, named scopes and validations.
What's the best way of drying these models up so they can share the same code?
Create a parent class and have these models inherit from that or would I be better off creating a module?
This is the type of code I'm looking to dry up:
has_many...
I am using Authlogic to do some simple signup and login stuff. In my WelcomeController I want to have the signup and login forms on the same page 'index' with form actions set to their individual controllers, UsersController and UserSessionsController, respectively. These controllers redirect the user to the protected profile page within...
I created a new model in my rails app. Since it's a one-to-one relation with another table, there's no need for the new model to have an id column. Everything is working fine, but for some reason, all of my Shoulda tests on this model are failing. For example:
should_validate_presence_of :first_name
is throwing this error:
ActiveR...
I'm using ROR trying to search a simple form at my college using mechanize. The code works fine for searching google, but returns the search form in the results? I'm really confused. Any advice? Thanks!
ruby script/console
require 'mechanize'
agent = WWW::Mechanize.new
agent.get("https://www.owens.edu/cgi-bin/class.pl/")
agent.page.form...
I currently have a rails app that uses the traditional caching. cache do blocks are used to cache slow-rendering partials. This works great for the most part, except for a few pages which take too long to render on the first read.
I'd like to move the rendering of these partials to the write-side from the read-side, by rendering in ei...
I'm attempting to send out an HTML e-mail containing a photo (handled by attachment_fu) hosted on Amazon S3 following the submission of an entry.
I keep receiving a nil object error when I try referencing the photo of an entry in ActionMailer. Here's the relevant code ...
class Entry < ActiveRecord::Base
include AASM
aasm_initial...
I can code in three languages/platforms: Java (its been long time), ruby on rails (beginner) and Drupal/PHP (beginner). This app is a pet project I really want to complete and involves some good business logic as well as need to have nice front end.
I really cannot decide which platform to chose. I have done some work in RoR and some in...
It must be a very common problem. I have a chained many-to-many relationship like this:
User n<==>n Role n<==>n List
ActiveRecord models:
class User
# linking to roles
has_many :role_assignments
has_many :roles, :through => :role_assignments
end
class Role
# linking back to users
has_many :role_assignments
has_many :user...
So in my feature file, I have a login background step:
Given /^I login$/ do
user = Factory(:user)
visit '/login'
fill_in("login", :with => user.login)
fill_in("password", :with => user.password)
click_button("Login")
@current_user = user
end
In the next step, I want to be able to include a user_id, but not sure how to get ...
I have a situation where children are built but not saved, and are then being used in the view with references to the parent. This leads to extensive use of rails record caching. I'd like to have the parent 'eager loaded' with the unsaved children records.
class Parent < ActiveRecord::Base
has_many :children
def make_children
lo...