[Rails] Re: scaffold and links created

2009-05-18 Thread Tom Z Meinlschmidt
add map.resources :users to your config/routes.rb file tom bandejapaisa wrote: > I used scaffold command > > generate scaffold User username:string password:string > email:string validation_code:string validated:boolean > > and when i go to http://localhost:3000/users/ i get this error

[Rails] Re: HABTM Self referential - only saves one way to join table

2009-05-15 Thread Tom Z Meinlschmidt
Bob, in HABTM are table names in alphabetical order, so your table name should be friends_members... tom Bob Mr. wrote: > I'm completely stumped by this. Basically, I've got an HABTM self > referential model set up and for some reason the join table is only > saving relationships one way. To i

[Rails] Re: having an integer matrix inside model

2009-05-15 Thread Tom Z Meinlschmidt
too much complex:) is good enough to keep only row#nr and seat#nr, eg table seats contains: id seat_number row_number is much faster to search/update tom Colin Law wrote: > Possibly > Auditorium has_many Rows > Row has_many Seats > Seat belongs_to Row > Row belongs_to Auditorium > > Co

[Rails] Re: observe_field - returning weird key/value pair

2009-05-15 Thread Tom Z Meinlschmidt
Sergio, show me the generated html of select and observer... t Sergio Ruiz wrote: > i am currently having a very strange problem with observe_field. > > i have a select box that looks like this: > >> <%= select "product_section", "section", ProductSection.find(:all, :order => >> "title ASC")

[Rails] Re: Gem Trouble

2009-05-15 Thread Tom Z Meinlschmidt
the problem is in fileutils - a part of osx. so you have to repair it in order to get gem work... tom mikej wrote: > No idea what I've done, I have not upgraded anything or installed new > gems but if I issue a command such as gem list, rake features, rake > routes or try and create a new rails

[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-13 Thread Tom Z Meinlschmidt
not support binary data writing? I got the error:No such file or > directory > > On 5月14日, 上午12时13分, Tom Z Meinlschmidt wrote: >> try to set passive mode >> >> >> >> daociyiyou wrote: >>> hi Tom >>> My ftp directory setting is right.ftp api

[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-13 Thread Tom Z Meinlschmidt
try to set passive mode daociyiyou wrote: > hi Tom > My ftp directory setting is right.ftp api need port to be specified? I > got another error > > ### > Net::FTPPermError (500 Illegal PORT command. ): > ### > > My codes is > > ### > Net::FTP.open('showreelfinder.com') do |ftp| > ftp.log

[Rails] Re: compare this sql query and corresponding ruby code

2009-05-13 Thread Tom Z Meinlschmidt
hi, try to look to your development log, u'll see sql queries there. and you might try this: ticket = Ticket.find(1, :include => [:activity]) and see your query again tom Sijo Kg wrote: > Hi >Suppose I have a two models Ticket and Activity > > Ticket has_many activities > Activity belon

[Rails] Re: forms & link css classes - not working

2009-05-12 Thread Tom Z Meinlschmidt
hi, has to be (style => class) tom wejrow...@gmail.com wrote: > I used a scaffold to create an interface. I'm trying to style it and > I'm having trouble. In my css I have: > > > #content a, a:link, a:visited{ > color: #ff8400; > } > #content a:hover{ > background: #ff8400; >

[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-12 Thread Tom Z Meinlschmidt
complete directory is > ftp://showreelfinder.com/www.showreelfinder.com/web/site/temp/uploads/heywatch/ > > On 5月13日, 上午12时29分, Tom Z Meinlschmidt wrote: >> back, your code is wrong >> >> ftp = Net::FTP.new(ftp_host) >> ftp.login('username',

[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-12 Thread Tom Z Meinlschmidt
back, your code is wrong ftp = Net::FTP.new(ftp_host) ftp.login('username','password') ftp.chdir('/www.showreelfinder.com/web/site/temp/uploads/heywatch/') ftp.putbinaryfile(thumbnail, encoded_video.title) ftp.close tom daociyiyou wrote: > Thanks. But i got another error: > > >

[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-12 Thread Tom Z Meinlschmidt
ftp.putbinaryfile(thumbnail,"ftp://showreelfinder.com/ www.showreelfinder.com/web/site/temp/uploads/heywatch/"+encoded_video.title) change to ftp.putbinaryfile(thumbnail,"/www.showreelfinder.com/web/site/temp/uploads/heywatch/"+encoded_video.title) tom daociyiyou wrote: > Thanks. But i got ano

[Rails] Re: a problem http POST params

2009-05-12 Thread Tom Z Meinlschmidt
because of security ... you need to specify 'removal' from token protection in your controller, eg class FormController << ApplicationController protect_from_forgery :only => [:create, :update, :destroy] def index ... end end Learning wrote: > this is my HTML: > > > > > and the

[Rails] Re: SocketError (getaddrinfo: Name or service not known)

2009-05-12 Thread Tom Z Meinlschmidt
remove ftp:// from you ftp_host variable daociyiyou wrote: > I want write image(thumbnail is binary data) to > ftp://showreelfinder.com/www.showreelfinder.com/web/site/temp/uploads/heywatch > directory. But i got error like following: > > SocketError (getaddrinfo: Name or service not known)

[Rails] Re: trouble linking models

2009-05-11 Thread Tom Z Meinlschmidt
Sean, did you check your database? Is user_id filled up correctly? tom Sean Six wrote: > Class User < ActiveRecord::Base > has_many :articles > > class Article < ActiveRecord::Base > belongs_to :user > > After a user posts an article, I want to include their username. I > presume I should j

[Rails] Re: including a blank in a dropdown

2009-05-11 Thread Tom Z Meinlschmidt
post your complete error code (with file and lines included). Then someone could help you. tom bingo bob wrote: > > Thanks for all these comments! > > However somethings else maybe going on... it's failing and I don't know > why. > > Even with this code. > > class WelcomeController < Appli

[Rails] Re: including a blank in a dropdown

2009-05-10 Thread Tom Z Meinlschmidt
look: bingo bob wrote: > > form... > > <% form_tag do %> > > <%= select("location", "id", Location.all.collect {|l| [ l.name, l.id > ]}, {:prompt => 'Any Location'}) %> > <%= submit_tag "go" %> > > <% end -%> > > With any location selected...I click go. > > params > > {"commit"=>"go",

[Rails] Re: including a blank in a dropdown

2009-05-10 Thread Tom Z Meinlschmidt
try to printout params .. def... render :inline => params.inspect end or post your development.log record. tom bingo bob wrote: > its great, only one minor problem. > > it doesn't work. -- === Tomas Meinlschmidt,

[Rails] Re: including a blank in a dropdown

2009-05-09 Thread Tom Z Meinlschmidt
you have to use select() instead of select_tag() or merge your options_from_collection_for_select with the "empty" please select tom bingo bob wrote: > > Can't get that working unfortunately. -- === Tomas Meinlsch

[Rails] Re: including a blank in a dropdown

2009-05-09 Thread Tom Z Meinlschmidt
rails api doc select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, {:prompt => 'Select Person'}) tom bingo bob wrote: > > Been trying all morning - daft thing ARGH! > > I'd like to have the top option in my drop down to be "please select" > and if that's the case A

[Rails] Re: RMagick, ImageMagick, Passenger and Dreamhost

2009-05-09 Thread Tom Z Meinlschmidt
did you perform ldconfig? did you try to find out where rmagick libs are? you can try to remove /usr/local/ruby/gem/1.8/cache/rmagick-*.gem (u have to correct the path) tom Daniel2Surf wrote: > Nobody??? Please... > > On May 8, 1:26 am, Daniel2Surf wrote: >> And also, >> If i do this: >> >>

[Rails] Re: Prevent HTML input

2009-05-09 Thread Tom Z Meinlschmidt
params[:form].each{|k,v| v.gsub!(/<[^>]*>/,'') } pankaj wrote: > How can this save form function be called for all the params passed? > > On May 9, 4:12 pm, Tom Z Meinlschmidt wrote: >> hi, >> >> just strip all the html tags, eg >> &

[Rails] Re: Prevent HTML input

2009-05-09 Thread Tom Z Meinlschmidt
hi, just strip all the html tags, eg def save_form params[:form]['textarea'].gsub!(/<[^>]*>/,'') ... end but that's very simple example, you have probably to construct more sophisticated solution (strip code inside javascripts etc) tom pankaj wrote: > Hi all, > Is there any plugin to p

[Rails] Re: can't get a simple partial to work !...@#!$!!

2009-05-09 Thread Tom Z Meinlschmidt
hi, try this: 7stud -- wrote: > > <%= render :partial => 'cart', :locals => {:mycart => @cart} %> <%= render :partial => 'cart', :collection => @cart %> >> Then use the variable mycart in the partial views/store/_cart.html.erb --- <%= cart %> tom -- ==

[Rails] Re: Change "onsubmit" event key from "return" key "ctrl-return"

2009-05-08 Thread Tom Z Meinlschmidt
hi, use javascript and make new handle of kbd events. search google, I think you'll find a lot of examples t Geekyra wrote: > Hello all, r there any way to change the "return" key in form single > line input ? For example, I want the form to submit the process using > "ctrl-return" key instead

[Rails] Re: sanitize_params + whiteList

2009-05-07 Thread Tom Z Meinlschmidt
hi, what about to put WhiteListHelper.tags += %w(a em p strong blockquote h2 ul li) into app/helpers/application_helper.rb ? instead of config/... tom Petan Cert wrote: > Hi all, > > I just installed whiteList and sanitize_params plugins to get rid of > with some bad html tags . > > Put

[Rails] Re: Controller redirect_to to leave iframe

2009-05-07 Thread Tom Z Meinlschmidt
nextpulse wrote: > Inside an iframe, I want the controller to redirect_to to the parent > (i.e. target ='_parent'). > Any ideas? > (Everything I've tried- via redirect_to - just keeps it inside the > iframe) > > use responds_to_parent plugin tom --

[Rails] Re: what database field type should i use ??

2009-05-07 Thread Tom Z Meinlschmidt
It's about performance. if you'll have marriage status (single/married/divorced/etc) in table marriagestatuses, and using belongs_to/has_many via marriagestatus_id, and not using :include => marriagestatuses in you 'queries', db will do a lot of queries just for a few enumerables. so each of

[Rails] Re: has_many through association

2009-05-07 Thread Tom Z Meinlschmidt
Intern ruby wrote: > 1) class Group < ActiveRecord::Base > > has_many :group_users > has_many :users, :through => :group_users > end > > 2)class User < ActiveRecord::Base > has_many :group_users > has_many :groups, :through => :group_users > end > > 3))class CreateGroupUsers

[Rails] Re: How to lock and unlock table in ruby on rails?

2009-05-07 Thread Tom Z Meinlschmidt
Venkat Eee wrote: > Brendon Whateley wrote: >> If you are using MySQL, you need to make sure that you are using a DB >> engine that supports transactions if you plan to use them. You will >> probably have to use SQL to do the table locking, so if you are using >> mysql look in the MySQL manual fo

[Rails] Re: what database field type should i use ??

2009-05-07 Thread Tom Z Meinlschmidt
just realize... in the case od 1st method: everything is simple, but db grows.. but... you made some typo mistake (eg Albama instead of Alabama) and what then.. repair entire table to get the correct results? weird 2nd method: I'm using it for a small enumeration lists (not hundreds/thousands

[Rails] Re: sum - wrong number of arguments?

2009-05-07 Thread Tom Z Meinlschmidt
zed? I don't know why I have conflicts > and they don't. > > Tom Z Meinlschmidt wrote: >> zkuste >> >> gem sources -a http://gems.github.com >> gem install yury-classifier >> >> tom >> >> Milan Dobrota wrote: >>> # without

[Rails] Re: sum - wrong number of arguments?

2009-05-06 Thread Tom Z Meinlschmidt
hname.new(line.gsub(re, > "[RAILS_ROOT]")).cleanpath.to_s } > end > > def rails_root > @rails_root ||= Pathname.new(RAILS_ROOT).cleanpath.to_s > end > > end > > > I read here > (http://blog.teksol.info/2009/03/27/argumenterror-on-

[Rails] Re: path problem

2009-05-06 Thread Tom Z Meinlschmidt
run "rake routes" command to show all possible routes and path/url names tom Stephen Fagan wrote: > Hi all, > > I am trying to create a mobile version of my application and for example > for the mobile forums in routes.rb is: > > map.resources :forums, > :controller => 'mobile

[Rails] Re: Hardcode database record reference into model

2009-05-06 Thread Tom Z Meinlschmidt
hi, I think you should use named_scope instead of this kind of access... class InventoryAccountType < ActiveRecord::Base named_scope :income, :conditions => {:name => 'Income'} named_scope :ordered, :conditions => {:name => 'Ordered'} end you can use it the same way but you can chain scop

[Rails] Re: page.visual_effect

2009-05-06 Thread Tom Z Meinlschmidt
Justin Mclachlan wrote: > I have something similar to a blog post that users can add comments to. > I'm use a partial to render the list of comments and a form that submits > a new comment via AJAX to update the list. The AJAX call uses the same > partial. My question is, how can I mark the last a

[Rails] Re: link_to :back problem

2009-05-06 Thread Tom Z Meinlschmidt
error log? elliottg wrote: > Hello, > > I have used <%= link_to "Back", :back %> many times with no issues. > This time I am getting this error: > > Unknown action > No action responded to index. Actions: access_denied, check_roles, > create, new, role_requirements, role_requirements=, and upda

[Rails] Re: open call works fine in irb but not through webrick server

2009-05-06 Thread Tom Z Meinlschmidt
irb != rails so try this script via script/console irb is interactive ruby console, so libraries etc could be different for ruby and for rails if this will work in script/console, then it will work via mongrel/webrick as well tm Karika wrote: > require 'rss/1.0' > require 'rss/2.0' > requir

[Rails] Re: Upgrade old rails app issues.. help

2009-05-06 Thread Tom Z Meinlschmidt
Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb so open config/environment.rb and make changes as required. tom <-_-_-|Rek2|-_-_--> wrote: > Hi I never had to upgrade someone elses rail application so this is > gettin

[Rails] Re: problems with scriptaculous..

2009-05-06 Thread Tom Z Meinlschmidt
try to: 1. change async mode of ajax to synchronous (to asynchronous:false) or 2. fire visual_effect from controller (instead of js) via render :update do |page| page.visual_effect :puff,'dom_id' end tom Sergio Ruiz wrote: > for some reason, i am having the hardest time with the simplest p

[Rails] Re: Rails plain ajax

2009-05-06 Thread Tom Z Meinlschmidt
try to add :method=>:get to your ajax rails helper... tom Joshua Partogi wrote: > Dear all, > > Does anybody know a good reference for sending ajax request to rails > without using the rails ajax helper? I want to use other framework, > namely jQuery. Because without using the ajax helper fro

[Rails] Re: sum - wrong number of arguments?

2009-05-06 Thread Tom Z Meinlschmidt
and source from: /home/milan/Projects/iq/blitzlocal_app/blitzlocal/vendor/plugins/exception_notification/lib/exception_notifier.rb:23 ? tom Milan Dobrota wrote: > I got the following error after I ran script/server: > > /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/layout.

[Rails] Re: Recommended webserver for deploying Rails

2009-03-18 Thread Tom Z Meinlschmidt
phusion passenger + apache? t Joshua Partogi wrote: > Dear all, > > What is the best architecture in terms of performance for Rails. Is > lighttpd + mongrel the most recommended deployment architecture for > Rails? Or is there any better architecture that outperform this > architecture? > > Tha

[Rails] Re: Searchable Rails API Doc

2009-03-16 Thread Tom Z Meinlschmidt
Hi, it looks great. one small issue - try to search 'link_to' and the last result item is: secret_key_generator.rb railties/lib/rails_generator/secret_key_generator.rb which has nothing to do with link_to .. see how did you perform the search :) tom voloko wrote: > I’ve been using rails and

[Rails] Re: Basic program but getting confused.

2009-03-15 Thread Tom Z Meinlschmidt
hi Jeff, best is to watch some screencasts (like blog app) and try it for yourself. Then add more data and forms.. and try to extend this basic skeleton app to fit your needs. tom Jeff Cornick wrote: > I'm trying to create a pretty basic program, I think. But I'm getting > confused with all

[Rails] Re: problem with AJAX when using passenger

2009-03-15 Thread Tom Z Meinlschmidt
try to add :method=>:get into your form_remote_tag ... <% form_remote_tag ( :url => {:controller => "networks", :action => 'search'}, :method => :get, :update => 'searchResults', :loading => "Element.hide('goBtn'); Element.show('fts-loader')", :complete => "Element.show('goBtn');El

[Rails] Re: problem with AJAX when using passenger

2009-03-15 Thread Tom Z Meinlschmidt
Tam.. I meant html source of generated page with the form... tom Tam Kbe wrote: > Thanks Tom: Here is the Ruby code > > - > def search > @page = params[:page] > @page ||= 1; > @search_phrase = params[:search_phrase] > @search_phrase ||= '' > > @users =

[Rails] Re: problem with AJAX when using passenger

2009-03-14 Thread Tom Z Meinlschmidt
what's in the source of generated page? c&p form code Tam Kbe wrote: > Hello, > > I just switched to using Passenger from using Apache/Mongrel cluster. > > I have an AJAX form: > > <% form_remote_tag :url => {:controller => "networks", :action => > 'search'}, >

[Rails] Re: Passenger - Internation Server Error

2009-03-14 Thread Tom Z Meinlschmidt
try to rename .htaccess to _htaccess (or delete), or add to apache config file AllowOverride AuthConfig tom Tam Kbe wrote: > Hello, > > I was just trying to use Passenger to depoloy my rails application of my > VPS: > Apache:2.2.3 (Debian) PHP:5.2.0-8+etch13 Phusion_Passenger/2.1.2 Serve

[Rails] Re: Installation of i18n

2009-03-14 Thread Tom Z Meinlschmidt
replace tab chars (\t) with spaces ... Sacredceltic wrote: > I get a "config/locales/fr-FR.rb:1: syntax error, unexpected ':', > expecting $end" > > Should the "en.yml' file end with a "end" ? > > > On Mar 14, 2:34 pm, Tom Z Meinl

[Rails] Re: Installation of i18n

2009-03-14 Thread Tom Z Meinlschmidt
my files: #file config/locale/en.yml en: date: formats: ddate: "%d.%m.%Y" time: formats: ddate: "%Y-%m-%d" dtime: "%H:%M" # and usage (somewhere in helper) def showdate(date) l(Time.at(date), :format => :ddate) end tom Sacredceltic wrote: > I desperate

[Rails] Re: Help with sorting / ordering

2009-03-13 Thread Tom Z Meinlschmidt
e group would buy it again or X reviewers in your area, etc. > etc. > > > > > Tom Z Meinlschmidt wrote: >> easiest and fastest way is to keep number of reviews in column in >> product table... then simple add :order => 'reviews_count desc' in your >

[Rails] Re: Help with sorting / ordering

2009-03-13 Thread Tom Z Meinlschmidt
easiest and fastest way is to keep number of reviews in column in product table... then simple add :order => 'reviews_count desc' in your Product.find() tom Robert Scott wrote: > Hi! I hope someone can offer some insight or direction into a problem > I'm having. > > In my application, I have

[Rails] Re: rails, passenger, and images

2009-03-13 Thread Tom Z Meinlschmidt
look into apache access_log, if there any regular requests to the js/image/css files.. I'm using passenger too without any problems... tom Steve Odom wrote: > Just switched over to passenger for development and production for my > rails app. Liking it so far. > > My problem is my image_links,

[Rails] Re: update a table depending on icon click

2009-03-11 Thread Tom Z Meinlschmidt
ut I don't know > what it should call. I don't want to execute any other controller > action. I want to remain within the "new" action and just set the > hidden attributes so they are saved along the others when the user > click on "submit" button of the &qu

[Rails] Re: Creating search using active record

2009-03-11 Thread Tom Z Meinlschmidt
Nick Hoyle wrote: > I am trying to create a search with two fields but struggling on how to > query it in active record. > > I have a view with two fields. text field #userstring and search by > value #searchby > > eg search bob by eithier name or id value > > How do i format a query using acti

[Rails] Re: Routing problem

2009-03-11 Thread Tom Z Meinlschmidt
Andrew Timberlake wrote: > On Tue, Mar 10, 2009 at 9:47 AM, Mako wrote: >> Hi all, >> >> I want the url something like this: >> >> http://localhost:3000/profile/anyusername >> >> This will access the controller: profile and the action: view and the >> value "anyusername" is the :username paramete

[Rails] Re: a beginner, i also encounter an issue about route.

2009-03-11 Thread Tom Z Meinlschmidt
iamzhouy...@gmail.com wrote: > the same issue talk here: > > http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/7080b9fd6ea71d4e/b798ef5d12b86bc1?lnk=gst&q=Routing+Error#b798ef5d12b86bc1 > ~ > i have also encountered an error=> > Routi

[Rails] Re: update a table depending on icon click

2009-03-11 Thread Tom Z Meinlschmidt
ake this selected/highlighted this.setAttribute("class", "highlited") // change other items ... } other way is to change radio buttons itself to images.. http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/ > > On Mar 11, 1:20 am, Tom Z Meinlschmidt wrote:

[Rails] Re: knowing when to go to multiple mongrel instances or dedicated server

2009-03-10 Thread Tom Z Meinlschmidt
Ed wrote: > I have a rails app with a growing user base. Right now it is on a > single mongrel instance on a shared server. Is there a quantifiable > method I can use to measure when I need to add mongrel instances, or > move to a dedicated server? Are there rules of thumb for how many > users

[Rails] Re: Managing migrations

2009-03-10 Thread Tom Z Meinlschmidt
elliottg wrote: > I have a migration "x" that when it runs self.up it adds a new column > to a table, and of course when self. down is run it deletes said > table... > > After I ran this migration I continued to work and in the process > added a couple other migrations. After a while I realized t

[Rails] Re: Phusion Passenger Installation Problem

2009-03-10 Thread Tom Z Meinlschmidt
Bob Martens wrote: > I would check your rubygems version and then also ask in the Passenger > group as well. > > On Mar 10, 4:21 am, elle wrote: >> Hello, >> >> I am trying to install Passenger on Mac OS 10.5 but running: >> % sudo gem install passenger >> gives me: >> >> Error installing passen

[Rails] Re: Making the 'Back' link look the same as form.submit "Save"

2009-03-10 Thread Tom Z Meinlschmidt
InventoryTrackers wrote: > Does anybody know how Rails paints that cool blue box around the <%= > form.submit "Save" %> > In most of my forms I've got a "Back" link ( ex: <%= link_to 'Back', > return_path %>. try to use Safari browser :) apple.com/safari .snap tom -- =

[Rails] Re: Help starting rails

2009-03-10 Thread Tom Z Meinlschmidt
Jeremy Woertink wrote: > hmm, ok so it's working now... kinda... > > It only works when I have my port set to 80. > > So, doing ruby script/server -p 80 > > > Why would this be? try to add -b 127.0.0.1 for sure.. script/server -p 3000 -b 127.0.0.1 if it doesn't work, post your netstat t

[Rails] Re: update a table depending on icon click

2009-03-10 Thread Tom Z Meinlschmidt
Sacredceltic wrote: > Hi, > > in a 'new' view for a persons model & controller, I want to be able to > present a number of attribute options in the shape of icons. Each > click on a different icon should set a given value to an attribute. > For instance, if the user clicks on the icon for a "girl