I'm thinking about creating a Rails 3 app that will integrate with an existing PHP app, using the same database.
The trouble is that the PHP app uses polymorphic associations of sorts, placing references to the PHP class names like MyPHPAppPrefix_User in the owner_type column. (Odd prefix stuff, yes, but what's done is done.) To reprodu...
I have implemented pagination using the will_paginate plugin.
I want have a drop down list where the user can display what number of records they display on each "page". The idea is once they select something, the current screen gets refreshed with the adjust number of records displaying.
The code I have isn't triggering a refresh... ...
Hi,
I'm trying to setup integrity for my project. Sadly, my bash-fu is poor so I need some help.
In build script I enter rake spec. In integrity it returns status 0 and output
(in /home/rails/integrity/builds/builds/66)
but I know, that I should got status 1 and output (after running it manually from console):
rails@integrity:...
Hi guys,
I have created a simple card game in Ruby on Rails+ajax with jQuery for animation. It's working Ok, and I wanted to develop a multiplayer version. It looks like it's not so simple as i thought.
I have also tryed to port the game completely to JS into the Canvas tag. This is possible for me and I could make the animation there ...
Hi,
I am writing my first ever plugin for rails. The plugin is supposed to extend the actioncontroller::base
so after going through the tutorials here is what i did...
# Foo
class << ActionController::Base
def function_name
assuming the plugin is called foo... but when i call function_name from an action, nothing happens... It see...
I created a drop down box in my form using select_tag:
<%= select_tag(:warning, options_for_select([['None', 1], ['Medium', 2], ['High', 3]], 1)) %>
Now I want to display the corresponding text for the value they select rather than the id in my show.html.erb, so it displays 'None' instead of 1. I am new to this and can't quite figure...
The Error :
2010-10-06T04:40:41-0700: * [Worker(delayed_job host:domU-12-31-39-0C-CC-64 pid:21517)] acquired lock on PhotoJob
2010-10-06T04:40:41-0700: * [JOB] delayed_job host:domU-12-31-39-0C-CC-64 pid:21517 failed with AWS::S3::NoSuchKey: The specified key does not exist. - 1 failed attempts
Paperclip matches the ID, but the ID sud...
Can you sell software built using Ruby on Rails? If so are there any pitfalls in doing so?
Is it any different to selling software built with PHP for example?
Edit: to elaborate - could I build a forum app like vB and sell that as they do?
...
Rails 3.0 deprecated f.error_messages and now requires a plugin to work correctly - I however want to learn how to display error messages the (new) native way. I am following the getting started guide, which uses the deprecated method when implementing the comments form. For example:
<h2>Add a comment:</h2>
<%= form_for([@post, @post.co...
Hi,
Country Model
set_table_name "countries"
has_many :states, :primary_key => 'col1', :foreign_key => 'col1'
has_many :cities, :through => :states, :primary_key => 'col1', :foreign_key => 'col1'
State Model
set_table_name "strain_appendices"
belongs_to :country
has_many :states, :primary_key => 'col2', :foreign_key => 'col2'
...
Hi,
I was looking at some tutorials on rails and found that people use a separate create function for saving form data. When i tried the same i was unable to repopulate the form, that is shown in the index.html.erb and is rendered by the index function. should i add a manual render command?
...
I am using the gem Searchlogic for Rails. Everything is working great. The only question I have left is how to have an element display, after the query, that says something like:
Search Results for "whatever"
I can't find anything in the docs. Anyone have suggestions? Here is my code:
/posts/index.html.erb
<% form_for @search do |f...
I have an Array extension method I want to use in my Rails 3 project. Where should it live?
I have a app/classes where I originally put it (array_extensions.rb), and in my config/application.rb I load the path: config.autoload_paths += %W(#{Rails.root}/app/classes). However, when I drop to rails console the extension is not loaded.
I...
Hi all..
I am new to RoR and I am experiencing the 500 server error for a long time without success.
I need someone tell me (or link to) how to debug RoR apps from the shell.
My application is redmine and I am trying to host it at hostmonster who tuns rails version 2.3.8
...
Sorry for my english ...
I need set some attributes to my object, but, I don't want to save them, I will save them after.
@object.attributes = params[:object]
@object.save
is working with other attributes like name, description ... but when I send habtm_object_ids[] rails save the association at this point:
@object.attributes = para...
To load small amounts of data, I've been using rake tasks to important data from CSVs into Rails:
desc "Import users."
task :import_users => :environment do
File.open("users.txt", "r").each do |line|
name, age, profession = line.strip.split("\t")
u = User.new(:name => name, :age => age, :profession => profession)
...
I have my main application layout, but then I have an /account section of my site which has exactly the same layout as the application layout markupwise, except the /account pages have an added sidebar in the content area of the layout.
Rather than blatantly copy the application layout and create a nearly redundant "account" layout, I'd...
I have followed the instructions in Chapter 13 of Advanced Rails Recipes. However, one of the fields for my nested model uses scriptaculous’ autocompleter.local. The drop down shows up for the first record in the nested model, but doesn’t show up for the others after I click the “Add” button. Any ideas? Here is my code from the partial:
...
I'm using Shoulda, Mocha, and Test::Unit for testing. I have the following controller and test:
class FoosController < ApplicationController
caches_action :show
def show
@foo = requested_foo
end
private
def requested_foo
Foo.find(params[:id])
end
end
class FoosCachingTest < ActionController::IntegrationTest
def s...
Hi there!
I'm writing a tiny Sinatra app, and I want to host it on Heroku for simplicity sake. But, what I have is a task that scraps some sites and adds some data into my database every hour. Currently this is just written as a ruby script that needs to be executed. What Heroku has is a rake based cron job. Now if this was a rails ...