[Rails] Re: How to pass a variable from a model method to a controller

2009-04-26 Thread Chris Kottom
Not 100% sure I understand what you're trying to do, but here are a couple of items that strike me based on the code posted. First, your model method has two return statements. I don't know whether Ruby will throw up some kind of parsing error to that, but certainly the second of those will never

[Rails] Re: reset_sessions how to?

2009-04-26 Thread 7stud --
vimal wrote: > Hi, > > Thanks for pointing it out. I'm sorry, sometimes i ask some stupid > questions. since my english is weak . Forgive me :) > > My answer is yes, the session prevails though i kill the server. > How can i overcome this by clearing the session information each > time the

[Rails] Re: reset_sessions how to?

2009-04-26 Thread vimal
Hi, Thanks for pointing it out. I'm sorry, sometimes i ask some stupid questions. since my english is weak . Forgive me :) My answer is yes, the session prevails though i kill the server. How can i overcome this by clearing the session information each time the rails server is killed. Tha

[Rails] Re: reset_sessions how to?

2009-04-26 Thread 7stud --
vimal wrote: > Hi, > > I am maintaining sessions for storing user informations. > When i logout i clear the session using reset_session. > > Will the session be available if i kill the rails server? > Try it and let us know. -- Posted via http://www.ruby-forum.com/. --~--~---

[Rails] reset_sessions how to?

2009-04-26 Thread vimal
Hi, I am maintaining sessions for storing user informations. When i logout i clear the session using reset_session. Will the session be available if i kill the rails server? If yes, Why does this happen and how can i overcome this by resetting the session? Please give me so

[Rails] Re: default values for new table entry

2009-04-26 Thread Robby Russell
You can do this in the controller, but I'd advise against this. Why? Business logic is best located and/or managed by the model. The easiest way to do this would be to modify the database column to set a default value, which Active Record will read when it looks at the table structure and use thi

[Rails] Re: default values for new table entry

2009-04-26 Thread big poppa
this worked great, thanks --b On Apr 22, 8:09 pm, Franco Catena wrote: > You can do this in the controller: > > @foo = Foo.new(:parameter_name => true) > > And then this in the view: > > form_for(@foo) do |f| > > f.check_box :parameter_name > > Regards. > > Franco Catena. > > On Apr 22, 5:24 pm

[Rails] Engines VS rails3

2009-04-26 Thread rails.n...@gmail.com
So in the recent doubleshot http://afreshcup.com/2009/04/24/double-shot-438/ there is the comment "Tips for writing your own Rails engine I’d wait for Rails 3 if I could myself." What is planned for Rails3 that is preferable over Engines? Would not moving to Engines now make it easier to ad

[Rails] Re: find_by_sql

2009-04-26 Thread Darren Strom
Guys thanks so much for all your help. The sql is working great. I really do appreciate your prompt replies. Thanks, so much once again. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[Rails] Re: problem inserting date_select values in the database

2009-04-26 Thread Sam Ginko
Solved the problem. I was using attr_accessible and forgot to include the date_select field in it. Stupid of me. thanks Frederick Cheung wrote: > On Apr 26, 8:20�pm, Sam Ginko > wrote: >> I'm trying to insert the selected values of the date_select object in >> the database but I'm getting noth

[Rails] Re: problem inserting date_select values in the database

2009-04-26 Thread Sam Ginko
Solved the problem. I was using attr_accessible and forgot to include the date_select field in it. Stupid of me. James Byrne wrote: > Sam Ginko wrote: >> I'm trying to insert the selected values of the date_select object in >> the database but I'm getting nothing >> >> controller looks like th

[Rails] Re: problem inserting date_select values in the database

2009-04-26 Thread James Byrne
Sam Ginko wrote: > I'm trying to insert the selected values of the date_select object in > the database but I'm getting nothing > > controller looks like this. > def create > @post = Post.new(params[:post]) > if @post.save > flash[:notice] = 'Post was successfully created.' >

[Rails] ruby mysql adaptor

2009-04-26 Thread Norm
I know that the versions of RoR after 2 want you to use the C adaptor for MySql.  Is there some reason for this other than performance?  Not all of us need the highest performance solution (or we wouldn't be using RoR) but it is more convenient to use an adaptor bundled in with the system.  Is

[Rails] Re: find_by_sql

2009-04-26 Thread pepe
In case any more help is needed, what Fred is saying is that the question mark is not going to be replaced by anything because you are using a string and not an array for your find_by_sql. When the code runs the question mark will stay and the SQL engine will probably either find nothing because '

[Rails] Re: Weird auto-complete production problem in Rails 2.3.2

2009-04-26 Thread pepe
Thanks for the explanation, but I was looking more towards of why the application works after changing that setting, which should have nothing to do about how sessions work, which I believe to be the real problem. I have noticed that when auto-complete fields are used and vaulues selected the ses

[Rails] Overriding a Relationships Propertry

2009-04-26 Thread MaggotChild
I have a child relationship that is denormalized. I want to normalize it at the object level once it's retrieved: class Parent has_many :denormalized_children, :class_name=>'Child' def children if @normalized_children.nil? @normalized_children = [] denormalized_children.gr

[Rails] To Rails Guide Authors...

2009-04-26 Thread 7stud --
I think the guide Getting Started with Rails isn't quite complete. Following along with your theme, you should create an action in the Post controller called "get". Don't worry, you are in good company with lots of other authors, who don't consider the names they use in their code very carefully,

[Rails] Re: Weird auto-complete production problem in Rails 2.3.2

2009-04-26 Thread 7stud --
pepe wrote: > Found a hack? > > I looked into the environments folder and compared development vs. > production. I found this line: > > config.action_controller.consider_all_requests_local = false > > I changed it to 'true' and the application now works. Any kind soul > that could explain this

[Rails] Re: Submit form through GET requets

2009-04-26 Thread 7stud --
7stud -- wrote: > 7stud -- wrote: >> >> Link.create("url" => params[:url]) >> >> (that assumes the links table has only one field: url) >> >> Apparently when you assign a Link object to the variable @link, rails >> will create a record in the database corresponding to the values in the >> Lin

[Rails] Re: Does anybody have an example of using Google Analytics to track unique pages?

2009-04-26 Thread Hassan Schroeder
On Sun, Apr 26, 2009 at 2:34 PM, InventoryTrackers wrote: > > I posted two days ago asking how this group tracks their traffic and > received the reply "Google Analytics?" > > I Googled on "Rails Analytics" and have gone about 20 pages back > without finding any explanations of how one installs a

[Rails] Does anybody have an example of using Google Analytics to track unique pages?

2009-04-26 Thread InventoryTrackers
I posted two days ago asking how this group tracks their traffic and received the reply "Google Analytics?" I Googled on "Rails Analytics" and have gone about 20 pages back without finding any explanations of how one installs and implements this into their code. I own most Rails books and find n

[Rails] Re: problem inserting date_select values in the database

2009-04-26 Thread Sam Ginko
It doe not insert anything into the database. I guess it's what you describe as "save but the birthdate attribute is not set" Frederick Cheung wrote: > On Apr 26, 8:20�pm, Sam Ginko > wrote: >> I'm trying to insert the selected values of the date_select object in >> the database but I'm gettin

[Rails] Re: find_by_sql

2009-04-26 Thread Frederick Cheung
On Apr 26, 4:48 pm, Darren Strom wrote: > Basically using > > and elevators.booked_date = ?, params[:booked_date] is causing only > errors. > > Any advise, I truely appreciate it. > much like the :conditions option requires either a string, or an array containing a string and the parameter va

[Rails] Re: problem inserting date_select values in the database

2009-04-26 Thread Frederick Cheung
On Apr 26, 8:20 pm, Sam Ginko wrote: > I'm trying to insert the selected values of the date_select object in > the database but I'm getting nothing > [snip] > > Am i doing something wrong? Not at first glance. Define nothing (date parameter is not in the request parameters at all, object does

[Rails] Re: What is the sequential steps of installing RoR?

2009-04-26 Thread Hongli Lai
On Apr 26, 8:06 pm, sheru wrote: > Hi, > I am Sheru & am completely new for this web framework. I am really > really enthusiastic to know the Ruby on Rails & possibly try to use > this framework near future. > > But at the start up, I don't have idea on installing RoR on Windows > XP. > > 1. What

[Rails] problem inserting date_select values in the database

2009-04-26 Thread Sam Ginko
I'm trying to insert the selected values of the date_select object in the database but I'm getting nothing controller looks like this. def create @post = Post.new(params[:post]) if @post.save flash[:notice] = 'Post was successfully created.' redirect_to :action => 'list' e

[Rails] What is the sequential steps of installing RoR?

2009-04-26 Thread sheru
Hi, I am Sheru & am completely new for this web framework. I am really really enthusiastic to know the Ruby on Rails & possibly try to use this framework near future. But at the start up, I don't have idea on installing RoR on Windows XP. 1. What is the sequential intalling components of RoR? 2.

[Rails] Re: SQLite3::SQLException: unable to open database file

2009-04-26 Thread Rainer
On Apr 26, 12:25 am, serenobs wrote: . . > > There is a db file at db folder named development.sqlite3 > what's wrong with me? > Somebody help me, please. > Did your migration complete successfully? i.e. does the table posts exist in your database? Does your database.yml file point to your db fil

[Rails] Re: Simple Question: How do I install Authlogic w/o git?

2009-04-26 Thread CakeCooker
i had the same problem.Your post solved the problem. Thanks guy. http://www.netsyscom.biz --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails

[Rails] Re: login system - user password being updated

2009-04-26 Thread Colin Law
Are you saying that after the update_attribute the password field is also changed? If so do you have some sort of filter that might be running and changing it? Possibly you could put debugger traps at each point you change the password and check it is not getting there. Also have a look in the l

[Rails] Re: Is Rails the Right Choice?

2009-04-26 Thread Carmine Paolino
Il giorno 26/apr/09, alle ore 17:53, Matt Jones ha scritto: > I know that you said not to discuss it, but seriously, why on earth > would this be a requirement? You're right, but it's a university project. --~--~-~--~~~---~--~~ You received this message because

[Rails] Re: login system - user password being updated

2009-04-26 Thread Stephen Fagan
I ended up kinda working it out. I now just reset the password and email the link to the user. Not 100% ideal but it works! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[Rails] Re: Concatenating to an array constant for options_for_select

2009-04-26 Thread Tom Milewski
This does the trick: <%= select_tag :role, options_for_select(Project::COMPANY_ROLES + ['Other...'], @relationship.role), :class => 'selectInput hasOtherValue' %> On Apr 25, 10:40 pm, Tom Milewski wrote: > Hello, > > I have the following code: > > <%= select_tag :role, options_for_select(Proje

[Rails] Re: Is Rails the Right Choice?

2009-04-26 Thread Matt Jones
On Apr 24, 4:39 am, Carmine Paolino wrote: > 2. The philosophy behind this project is "Use the XML technologies as   > much as possible", so a major requirement is to not use a db _at all_   > (no berkeley db xml, please). > I know that you said not to discuss it, but seriously, why on earth wou

[Rails] find_by_sql

2009-04-26 Thread Darren Strom
I'm having some difficulty getting find_by_sql to work. This code below works perfect: @available = Elevator.find_by_sql("select name from elevator_timeslots WHERE NOT EXISTS(select elevator_timeslot_id from elevators where elevators.elevator_timeslot_id = elevator_timeslots.id)") Now I'm tryin

[Rails] Re: form.collection_select utilizing CONSTANT string array?

2009-04-26 Thread Matt Jones
The containing module for the ERB code isn't the model or the controller, it's part of ActionView::Base. Try explicitly qualifying the constant as Client::TITLES. Also, module names are not traditionally spelled in all-caps, but that's just a style thing. --Matt Jones On Apr 24, 5:52 pm, Coond

[Rails] Creating a WYSIWYG editor with Protoype and Scirptaculous

2009-04-26 Thread Fernando Perez
Hi, In my little blog engine, display a sidebar that has the 10 latest images I have uploaded, it's a list formatted with its Textile html equivalent. So I'd like to make my little list draggable. That's easy, but now the problem is that when I drop an element, it should add the test where I dro

[Rails] login system - user password being updated

2009-04-26 Thread Stephen Fagan
I am developing a small site. The login system works fine and I am using the sha1 hashing alg to hash passwords. I have an admin side that can enable or disable users. The problem seems to lie in the disable (destroy) method. When I disable a user, it updates the password to a new password so when

[Rails] Re: SQLite3::SQLException: unable to open database file

2009-04-26 Thread serenobs
Of course ruby, ruby gems and sqlite3 are installed on my system (CentOS 5.3) #gem install sqlite3-ruby Building native extensions. This could take a while... Successfully installed sqlite3-ruby-1.2.4 1 gem installed Installing ri documentation for sqlite3-ruby-1.2.4... Installing RDoc documenta

[Rails] Re: Combining acts_as_taggable, will_paginate and scope_out

2009-04-26 Thread Commander Johnson
Found! :D Model: # XXL name to prevent override meta-methods such as paginate_published def self.paginate_all_published_posts(options) self.with_published do return self.paginate(options) end end Controller: @posts = Post.paginate_all_published_posts(options) On Sun, Apr 26

[Rails] Re: named_scope and Time.zone

2009-04-26 Thread ionlydoeyes
*Smacks forehead* Thanks Colin & Frederick for the responses - it makes sense now. I modified to use lambdas and it seems to be working as expected: class Event named_scope :upcoming, lambda { { :conditions => ["starts_at >= ?", Time.zone.now.beginning_of_day] } } end --~--~-~-

[Rails] Combining acts_as_taggable, will_paginate and scope_out

2009-04-26 Thread Commander Johnson
I want to display published posts that are tagged using will_paginate. Options include: 1. Add :conditions => { :published => true } to the find options. Does not work because will_paginate will then return too many records. 2. Use scope_out in class Post like this: scope_out :published, :conditi

[Rails] Re: Submit form through GET requets

2009-04-26 Thread 7stud --
7stud -- wrote: > > Link.create("url" => params[:url]) > > (that assumes the links table has only one field: url) > > Apparently when you assign a Link object to the variable @link, rails > will create a record in the database corresponding to the values in the > Link object. If you look at

[Rails] Re: Weird auto-complete production problem in Rails 2.3.2

2009-04-26 Thread pepe
Found a hack? I looked into the environments folder and compared development vs. production. I found this line: config.action_controller.consider_all_requests_local = false I changed it to 'true' and the application now works. Any kind soul that could explain this to me? I'm not really a Rails

[Rails] Re: Submit form through GET requets

2009-04-26 Thread 7stud --
Cisco Ri wrote: > When I use <% form_for :link, > :url => {:action => :new}, > :html => {:method => :get} do |f| %> > > the type http://www.gmail.com into the form and hit submit, the address > bar changes to > http://localhost:3000/links/new?link[notspamurl]=http%3A%2F%2F

[Rails] Re: Weird auto-complete production problem in Rails 2.3.2

2009-04-26 Thread pepe
Still trying to figure this out. Some more info: The auto-complete field that does not work depends on the values entered in 2 other auto-comple fields. In development the 2 fields are being updated correctly but not when the application runs in production mode mode. Those values are stored in s

[Rails] Re: change link color on mouse over

2009-04-26 Thread Jay Pangmi
Samiron Rony wrote: > Include the following CSS property for all the anchors in your project > > a{ >outline:none > } > I checked the code in firefox, chrome and IE7. Hope this will work. > If u r using different CSS classes just make sure that any other class > doesnt override this prop

[Rails] Weird auto-complete production problem in Rails 2.3.2

2009-04-26 Thread pepe
Hello. ruby 1.8.6 (patchlevel 111) rails 2.3.2 Windows XP Professional I am getting quite a weird problem. I have several auto-complete fields in a page. When I run the code in development mode everything works but when the application runs in production mode one and only one of the fields does

[Rails] Re: change link color on mouse over

2009-04-26 Thread Samiron
Include the following CSS property for all the anchors in your project a{ outline:none } I checked the code in firefox, chrome and IE7. Hope this will work. If u r using different CSS classes just make sure that any other class doesnt override this property. Thank u On Apr 26, 5:01 pm,

[Rails] Re: Changing the ActiveRecord mapping of boolean values in t

2009-04-26 Thread Roderick van Domburg
Thomas Waswasi wrote: > I want to insert some rows into a sqlite3 database where some tables > contain BOOLEAN columns. > > Some older applications accessing the same DB require boolean columns > to be 0 and 1, whereas the default behaviour of the sqlite Adapter is > a mapping of true/false value

[Rails] Changing the ActiveRecord mapping of boolean values in the DB ?

2009-04-26 Thread karfas
Hi, I want to insert some rows into a sqlite3 database where some tables contain BOOLEAN columns. Some older applications accessing the same DB require boolean columns to be 0 and 1, whereas the default behaviour of the sqlite Adapter is a mapping of true/false values to 't' and 'f' in the datab

[Rails] Re: "no such file to load -- sqlite3" Rails

2009-04-26 Thread Ehtsham Abbas
M. Figueiroa wrote: > In my case I just downloaded the sqllite3.dll from the > http://www.sqlite.org/download.html (This is a DLL of the SQLite library > without the TCL bindings. The only external dependency is MSVCRT.DLL.) > and then copied it to the Windows\System32 folder. It worked. MY P

[Rails] Re: change link color on mouse over

2009-04-26 Thread Jay Pangmi
Frederick Cheung wrote: > On Apr 26, 7:01�am, Jay Pangmi > wrote: >> Hassan Schroeder wrote: >> > On Sat, Apr 25, 2009 at 7:00 AM, Jay Pangmi >> > wrote: >> > >> === >> === >> >> � http://www."; class = "side-link

[Rails] Re: Submit form through GET requets

2009-04-26 Thread Cisco Ri
When I use <% form_for :link, :url => {:action => :new}, :html => {:method => :get} do |f| %> the type http://www.gmail.com into the form and hit submit, the address bar changes to http://localhost:3000/links/new?link[notspamurl]=http%3A%2F%2Fwww.gmail.com&commit=Create (

[Rails] Re: Submit form through GET requets

2009-04-26 Thread Cisco Ri
Rails 2.3.2. Yeah, I meant that is the view. The relevant actions in the controller are: # GET /links/new # GET /links/new.xml def new @link = Link.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @link } end end # POST /lin

[Rails] Re: Submit form through GET requets

2009-04-26 Thread 7stud --
Cisco Ri wrote: > > Right now my controller looks like: > > <% form_for @link, :method => :get do |f| %> 1) Controller? Isn't that a View? 2) Looking at an example in my book for form_for shows that the first argument for form_for is a Symbol, e.g. :link. 3) You didn't specify the action(a me

[Rails] validators.rb breaks after update from Rails 2.2.2 to 2.3.2

2009-04-26 Thread John Mackin
I just updated my rails application from 2.2.2 to 2.3.2 and the following message is displayed while trying to start with ./script/ server: [code] => Booting Mongrel => Rails 2.3.2 application starting on http://0.0.0.0:3000 /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/ active_suppor

[Rails] Re: change link color on mouse over

2009-04-26 Thread Frederick Cheung
On Apr 26, 7:01 am, Jay Pangmi wrote: > Hassan Schroeder wrote: > > On Sat, Apr 25, 2009 at 7:00 AM, Jay Pangmi > > wrote: > > === > === > >   http://www."; class = "side-link">Home >   <%= link_to "Products", :a

[Rails] Want to switch my apps to RonR

2009-04-26 Thread vnguyen.viet...@gmail.com
Hello everyone, Please help, need 2 developers to switch my website from php to RonR. Please give quote http://www.nhadatvina.vn Vnguyen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group

[Rails] Re: background process fork - generating zip files

2009-04-26 Thread Morgan Christiansson
Carlos Santana wrote: > I am really confused now. > The FAQ says - Mongrel uses one thread per request. > So it can handle multiple requests (not surprising). > > What you are suggesting is that my archiving method is trying to make > another http req. call within same http request? > > I can se

[Rails] Re: [JOBS] Looking for a Rails tutor 20 USD/hour Part-Time and Remote

2009-04-26 Thread Ashwin Mangale
Hi Bob, I am interested. Let me know if this position is still open. I can send across my resume. -Ashwin On Sat, Apr 25, 2009 at 6:03 AM, bobby.cheng@gmail.com < bobby.cheng@gmail.com> wrote: > > Hi, > > I'm looking for some who has a good understanding with Rails and > RSpec. > You b

[Rails] Re: Back in PHP/CSS hell

2009-04-26 Thread kallep
Thanks @Tom Ha I have been looking at YUI earlier. I use Jquery and did find YUI a bit of a overkill. Do YUI offer some advantages over other CSS frameworks for example Blueprint and Grid 960 ? It seems they do more or less the same thing? > I likehttp://developer.yahoo.com/yui/ > -- > Posted v