[Rails] nicEdit image upload

2009-08-03 Thread Xiahong Gao
Hi everyone I am new in ROR. Recently, I want to integrate nicEdit to my application. However, the default image upload functionality doesn't support upload image to local server. How can I upload image to local server with nicEdit? thanks in advance xiahong --~--~-~--~~~

[Rails] how to integrate attachment_fu with tinymce

2009-07-28 Thread Xiahong Gao
Hi, I'm using tinyMCE plugin. I want to add image upload functionality - the standard tinyMCE image pop-up doesn't really provide a great user experience. Are there any rails friendly plugins to allow for a image browser and uploader through tiny? for example, attachment_fu? thanks in advance x

[Rails] how to get the value of a text field

2009-07-22 Thread Xiahong Gao
Hi everyone, I need to get the value of one text field when clicking "next page". My code looks like: this is the view page: <% form_tag('javascript:void(0)') do %> <%= text_field_tag 'search' %> <%= observe_field :search, :frequency => 0.5,

[Rails] attachment_fu problem:

2009-07-15 Thread Xiahong Gao
Hi everyone, I was trying to do image upload by using attachment_fu but got no lucky. I have 2 models: album and cover. Each album is associated with only one cover. The database is like: create_table :covers do |t| t.integer :album_id t.timestamps # the following fields are re

[Rails] test problem

2009-07-13 Thread Xiahong Gao
Hi everyone, I ran into some problems during testing. The problem was like: root> ruby test/unit/game_test.rb /usr/lib/ruby/1.8/test/unit/assertionfailederror.rb:7: Test is not a module (TypeError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'

[Rails] how to integrate svn with rails

2009-07-13 Thread Xiahong Gao
Hi everyone, I am a newbie on rails. I tried to use svn to control my code version. However, I found the following problems: When I typed in "ruby script/generate scaffold product", the added files were not applied in svn. The same problem occurred when I deleted some files by typing in "ruby s

[Rails] mailbox model

2009-07-13 Thread Xiahong Gao
Hi everyone, I ran into some problems when modeling mailbox and mails. My code was like: create_table :mailbox do |t| t.integer :user_id # the owner of this mailbox end create_table :mails do |t| t.integer :sender_id t.integer :receiver_id t.string :title t.text :content end class Ma

[Rails] HABTM - primary key problem

2009-07-02 Thread Xiahong Gao
Hi everyone, I ran into a serious problem when I was trying to do something similar to twitter follow mechanism. The thing is like this: First, I have a self-referential table, named "users" create_table :users do |t| t.column :name, :string t.column :user_name, :string t.col

[Rails] duration of session

2009-06-30 Thread Xiahong Gao
Hi everyone, how to set the duration of a session? Does "ActionController::Base.session_options[:new_session] = ... " work? Another question is if i am using database for session storage, when a session expires, will rails automatically remove the session record from database for me? thanks in a

[Rails] session or flash

2009-06-30 Thread Xiahong Gao
Hi everyone, What's the difference between Flash and Session? Probably the most common use of the flash is to pass error and informational strings from one action to the next. But I wonder why I can't use session for this purpose. For example, I found the following piece of code in "Agile web de

[Rails] session cleanup

2009-06-24 Thread Xiahong Gao
Hi everyone, I am a newb. Can anyone tell me how to do session cleanup? I want to cleanup those sessions which haven't been modified in recent 5 minutes. How to make it a background process in my rails application? thanks in advance, xiahong --~--~-~--~~~---~--~~

[Rails] question about create_table

2009-06-22 Thread Xiahong Gao
Hi everyone, I am a newb. I have one question about following code: def self.up create_table :order_histories do |t| t.column :order_id, :integer, :null => false t.column :created_at, :timestamp t.column :notes, :text end end so, create_table is a method which takes the name of

[Rails] how params (without @) works?

2009-06-21 Thread Xiahong Gao
I am newb. I feel confused about how params works. I understand @params is an attribute of CLASS, but what is params? A named parameter? Because I thought instance attributes always begin with "@”, so params/request/flash/etc looks like a local variable. thanks in advance Xiahong --~--~-

[Rails] NoMethodError in Store#add_to_cart

2009-06-18 Thread Xiahong Gao
Dear all, I'm going, by the book, through the book "Agile Web Development with Rails, 2nd edition". I get stuck in section 8.2 I am running into following error: NoMethodError in Sto