I am using ruby on rails with a MySQL backend. I have a table called notes and here is the migration I use to create it:
def self.up
create_table(:notes, :options => 'ENGINE=MyISAM') do |t|
t.string :title
t.text :body
t.timestamps
end
execute "alter table notes ADD FULLTEXT(title, body)"
end
I want to do full te...
If I'm adding a column via MySQL, I can specify where in the table that column will be using the AFTER modifier. But if I do the add_column via a Rails migration, the column will be created at the end of the table.
Is there any functionality for rails migrations to specify the position of an added column?
...
I'm trying to consume Sharepoint webservices with ruby. I've basically given up trying to authenticate with NTLM and temporarily changed the Sharepoint server to use basic authentication. I've been successful getting a WSDL using soap4r but still cannot authenticate when attempting to use an actual web service call.
Has anyone had any...
Hi, I have uploaded some files to a directory under public and I try to access them using Dir.glob. But I get no results back.
The Dir.glob works fine on dev server (mongrel) and also works fine when using script/console on the site installed on site5
is there a way to get this working or a different way to get the list of files?
...
What is the purpose of this Rails config setting...
config.action_controller.consider_all_requests_local = true
It's set to true by default in config/environments/development.rb.
Thanks,
Ethan
...
What is the best way to add records to a database from an external script. I would like to use activerecord but I'm not sure how to do so outside the rails directory structure.
...
An example of what I'm talking about:
class Person < ActiveRecord::Base
def name=(name)
super(name.capitalize)
end
def name
super().downcase # not sure why you'd do this; this is just an example
end
end
This seems to work, but I was just read the section on overriding attribute methods in the ActiveRecord::Base docs (...
Does anyone know why there are question marks (with a number) after the images and css files (when looking at the html code)? And how can I turn them off?
...
Hi,
I'm looking for a Web UI toolkit for a Rails-based application. I have an experience with YUI but not in a Rails context. I have many questions I wish you could help me to answer.
Do you use a web UI toolkit like YUI, ExtJS or JxLib within your Rails application ?
Which UI toolkit is the most Rails-friendly ? Since most are not ba...
Hey all, I have something of an interesting requirement for my project. I need a has_one relationship where it is either one class or the other, but without inheritance. I could get away with inheritance if it is the only way, but the two associate records have completely different data and aren't related at all.
What I need to figure...
my ruby (on rails) class looks like:
class Foo
def self.method1
someAction
end
def self.method2
someAction
end
def someAction
//doSmth
end
end
any ideas how to make this work or achieve the same behavior some other way?
thanks!
...
Hello all,
I've been struggling with this for quite awhile and haven't been able to
find a solution. I need a user to be able to view multiple top level
domains with a single login.
My understanding is that this needs to be set in environment.rb and
called with before_dispatch. This is what I've come up with:
require 'activesupport'
r...
I currently have code in my ApplicationController to check if a user is logged in and has the required access to perform a given action (the tests take place in a before_filter).
I require the same functionality in the views to decide if I should be showing the admin links in a list view, but how do I best avoid duplicating code in the ...
I'm currently using the default cookies as my single sign on (SSO) but some users are getting strange errors after I push an update. I'm considering moving to active record to store sessions but was wondering how I tell rails that the sessions are in another database?
So if I store sessions via AR in App1DB how can all the other apps kn...
I have two versions of rails (2.1.0 and 2.2.2) installed in my computer.
When I create a new application, is it possible to specify that I want to use the older (2.1.0) version?
...
I have this structure in my app:
USER has_one :publicprofile, :privateprofile
PUBLICPROFILE has many :emails, :phonenumbers
PRIVATEPROFILE has many :adresses, :creditcards
I would like to know how to go about having a profile page for the user where I can update his nested resources (and do it in a RESTful way). I couldn't find any d...
I have periodically_call_remote updating a div (main_div) in my web app. This main_div contains links that the user can click that invokes an action that overwrites data within main_div.
My problem is that the timer is running on the periodically_call_remote function and even though the user has navigated away from the page, that functi...
Suppose I am entering validation code into my model of multi-language publication database. The database needs either an English or a Japanese title for a particular journal. So I need to validate_presence_of at least one of the two. Right now I can easily check that both exists, but am stumped on the case of "at least one":
class Artic...
When I use link_to :method=>:delete, what rails has generated is a javascript click, which is not nice if you do come across situation your client just have javascript disabled. That seems a bad idea to me. Any chance to get around this?
...
I have been doing two projects on Rails which have worked out quite nicely but have in the process reinvented the wheel, running (and hot) water and painkillers which are as I have learned subsequently already present in the framework.
So basically, what is the best way to properly get know all the clever parts in the framework that wil...