I want a sample application which is of Rails and the database Mysql and the server Apache.
Please let me know if any such application is available.
Thanks in advance
I am using Opensolaris machine.
...
Hi folks,
I'm new to rails & trying to set up my first embedded form. The form itself works, but I can't determine how to send validation error messages to the view. I assumed f.object.errors would provide access, but while the method is said to exist, f.object.errors.count always returns 0, and f.object.errors.any? returns false. Apart...
I have a spec for testing a controller as below
require 'spec_helper'
describe ProductsController do
setup :activate_authlogic
describe "user not logged in" do
it "should not GET index" do
get :index
response.should redirect_to(login_path)
end
end
describe "user logged in" do
before(:each) do
UserSession.create :username => "rohit...
I have a list of items to be dragged and dropped to a list of slots on a page. This is working fine using drop_receiving_element and draggable_element.
There is no limit to the number of possible draggable items, so I set "overflow: auto" on the div that holds them to add a scroll-bar. Now the item cannot be dragged outside of the div. ...
If I change the type of a field in my database via a Ruby on Rails migration, from string to text, will I lose the data in the field?
...
Supposedly, ActionController::Base.helpers acts like a proxy for accessing helpers outside views. However many of the methods defined there rely on controller variables and I'm unable to succesfully call:
ActionController::Base.helpers.image_path("my_image.png")
>> TypeError Exception: can't convert nil into String
Digging at the sour...
I want to run Paperclip on all files in a directory on the server. Basically, I would like to allow users to FTP some files to my webserver, then I can manually run a rake task to have Paperclip process all of the files (resize the images, update the database, etc).
How can I do this?
...
We all know that we have this code in our create action of any basic controller
def create
if @product.save
flash[:notice] = 'Product was successfully created.'
redirect_to(products_path)
else
flash[:notice] = "Data not saved try again"
render :action => "new"
end
end
how do we test this part of co...
I'm trying to write an iterator in ruby that sends a callback on the first of every month.
How would you write something like that?
...
I need to access a legacy relational database via ActiveRecord and that database uses a column named "object_id" as a primary key in a table. Most things work but when I try specify a custom SQL query for an association (see below) ActiveRecord respectively the Ruby interpreter always retrieves the object_id of the Ruby base "Object" ins...
Im creating a simple Rails 2.3.8 gem and need a migration file inside it. I following this structure:
/
/generators
/generators/conductor_migration
/generators/conductor_migration/conductor_migration_generator.rb
/generators/conductor_migration/templates
/generators/conductor_migration/templates/conductor_migration.rb
but when I inst...
I've been looking for hours on how to get this to work but have still come up with nothing. Right now it's difficult because to run Phusion Passenger I need to have web sharing enabled (on my mac) but then I can't run MAMP PRO because it needs web sharing to be turned off for it to work. So I'm constantly going back and forth and turning...
Hey,
I have a model Rails model called Orders that has a type_id, location, and price. Each type can have multiple orders at the same location with different prices. Check below for a idea of the table structure.
id | type_id | location_id | price
-----------------------------------
1 | 1 | 1 | 12
2 | 1 | 1 ...
I'm trying to set up an input tag with jquery autocomplete function, but it's doesn't work when Im referring to an external JSON data. It works perfectly, however, with local JSON-like array... Let me explain this in my code:
HTML file:
<html>
<head>
<meta charset="utf-8">
<script src="jquery-1.4.2.min.js" type="text/javascript"></s...
Hi dear stackers,
I'm trying to deploy some changes, and I just cannot see them as the URL I got sends me on a Phusion error page "Ruby on Rails application could not be started".
When I check the logs, I get something like this:
Exception ArgumentError in PhusionPassenger::Railz::ApplicationSpawner (syntax error on line 36, col 1: `...
I found this add-on for the Money gem which updates from the ECB European Central Bank (updates its rates every 24 hours) but I'm unsure how I should go about caching in my rails app which uses multiple currencies.
http://github.com/RubyMoney/eu_central_bank
eu_bank ||= EuCentralBank.new
eu_bank.update_rates
#Rails.cache.fetch('rates',...
I am trying to run Rails3 on XP Profesoinal and following the tutorial here http://railstutorial.org and am receiving the following errors all the time, even trying to return static pages. The message is the procedure entry point rb_str2cstr could not be located in the dynamic link library msvcrt-ruby191.dll
Also, the page gives a runti...
So it turns out mailers hate loop inside of them. So here's my loop.
- for ["love", "hate", "war"].each do |f|
= f
Which returns this went sent through actionmailer in rails 2.3.5 :
promotion_reminder.html.haml:17: syntax error, unexpected ';', expecting tCOLON2 or '[' or '.'
...ry_temp));}\n", 0, false);end;_hamlout.push_text(" ...
Greetings Rails and Javascript Gurus!
I have a project where I am returning a large javascript file in a
respond_to do |format|
format.js
end
block.
I am trying to figure out how I can minify or compress the .js response since the .js.erb view is full of comments and varies in size based on the results from the controller.
Anyo...
I've got the following spec in spec/views/users/new.html.erb_spec.rb:
require 'spec_helper'
describe "users/new.html.erb" do
it "displays the text attribute of the message" do
render
response.should contain("Register")
end
end
But when I run the test it fails with:
ActionView::TemplateError in 'users/new.html.erb displ...