Hi,
when contructing a http form parameter for a Boolean, what value ca be used to represent true?
That is, ruby on rails database field set to BOOLEAN for a mysql database.
...
In my User.rb model, I have this line:
validates_confirmation_of :password, :message => "Your passwords should match."
Then when the user signs up, the passwords match, everything is great... until I want to add more information to the user object, then save again. But running @user.save returns the error that my passwords don't match...
I am really really stuck and annoyed with this right now.
I am running Rails 2.3.5
My View/pages/customers.html.erb simply has:
<% form_tag do %>
First Name
<%= text_field_tag :firstName, params[:firstName] %>
Last Name
<%= text_field_tag :lastName, params[:lastName] %>
<%= submit_tag "Enter" %>
<%end...
I just tried to run
cap deploy:setup
on the command line, but it wanted it to run on just one particular server instead of them all. Is there a way to run a task on just one server from the command line, or do I have to define it that way in the deploy.rb file?
...
Or rather I don't know how to specify the route for it.
I have my controller setup us:
def tags
@clients = current_user.clients.find_tagged_with(params[:tag])
end
and my views
Tags:
<% for tag in @client.tags %>
<%= link_to tag.name, clients_path(:view =>'tag', :tag => tag.name) %>
<% end %>
Only problem is that the link (cli...
I am currently developing a blogging system with Ruby on Rails and want the user to define his "permalinks" for static pages or blog posts, meaning:
the user should be able to set the page name, eg. "test-article" (that should be available via /posts/test-article) - how would I realize this in the rails applications and the routing file...
I want to distribute a Rails application within a .app package, so it can run from 10.4 to 10.6; is there any howto or hint on how to do that? Especially the following things make me twist my head:
I want to repackage the app with Ruby 1.8.6, so it would run even if there is an older version of Ruby installed on the system (such as 1.8...
i am developing on 5 different rails projects, plus also refactoring some (moving from older rails versions to 2.3) - what is the best way to extract the error information from the logfiles, so i can see all the depreciation warnings, runtime errors and so on, so i can work on improving the codebase?
are there any services or libraries ...
Is there an easy way to create a sitemaps file for Rails projects? Especially for dynamic sites (such as Stack Overflow for example) there should be a way to dynamically create a sitemaps file. What is the way to go in Ruby and/or Rails?
What would you suggest? Is there any good gem out there?
...
I'm creating a Twitter application, and every time user updates the page it reloads the newest messages from Twitter and saves them to local database, unless they have already been created before. This works well in development environment (database: sqlite3), but in production environment (mysql) it always creates messages again, even t...
hi i want translate the names in Date::ABBR_DAYNAMES in ita
and so i've put in locales/it.yml this:
date:
formats:
default: "%d-%m-%Y"
short: "%d %b"
long: "%d %B %Y"
day_names: [Domenica, Lunedì, Martedì, Mercoledì, Giovedì, Venerdì, Sabato]
abbr_day_names: [Dom, Lun, Mar, Mer, Gio, Ven, Sab]
in my view i try to translate a d...
Hi,
I installed Sphinx and Thinking-Sphinx some days ago on my ruby on rails 2.3.2, and basic searching works great. This means, without any conditions. Now, I want to filter the search with some conditions.
I have the Announcement model, and the index looks as follows:
define_index do
indexes title, :as => :title, :sortable => ...
I have a newbie question about developing interactive, dynamic web sites. Can someone explain concisely the differences between:
Django
Ruby on Rails
Google App Engine
CGI scripts/apps
whatever else is or seems similar (PHP?, Java Servlets?, TurboGears?, etc.)
When would I prefer, say, the Google App Engine over Django, etc.? If I wa...
Is it possible to develop multi-client web-based CRUD applications (with Django, Ruby on Rails, etc.) on a server on which you don't have root access?
Our machines at school, on which I have a regular account, run a web server, and I can publish regular HTML pages and CGI scripts. How easy/difficult/impossible would it be to install Dja...
What are the advantages and disadvantages of creating a module like:
module Section
def self.included(base)
base.class_eval do
has_many :books
end
end
def ensure_books
return false if books <= 0
end
end
...where ActiveRecord methods are used in the module instead of directly on the class(es) they belong to?
...
I have a table Blog belongs to User through user_id.
I'm using thinking sphinx to index the blog, but I only want it to index blogs where the user is currently active (user.status = User::ACTIVE).
I have the code below for creating the index, but I know the 'where' clause is wrong. What should it be?
define_index do
indexes title
...
I'm all for the skinnier controller, fatter model mindset.
I wanted to know how to go about:
How you identify things that should be moved to your model (assuming you're like me and you get lazy and need to refactor your controllers because you just shove code in there)
How you write and structure the creation of new elements in your c...
I'm a Rails dev, and some of the Cappuccino Rails concepts look damn compelling. Can I develop Cappuccino apps on a Windows (Vista) machine?
...
Is there a rails plugin or gem out there that allows users to upload their image by emailing the image as an email attachment?
...
I have a model Vote, and I'm using an after_validation callback.
class Vote < ActiveRecord::Base
after_validation :destroy_reciprocal_votes
belongs_to :voteable, :polymorphic => true
belongs_to :voter, :polymorphic => true
private
def destroy_reciprocal_votes
votes = Vote.delete_all(:vote => false, :voteable_type => "...