[Rails] Re: Rails is slow to load
That did cross my mind, but I was just wondering though. Mostly because it didn't look as though the transition from running the command to the actual test running wasn't edited. But oh well. On Aug 4, 2:54 pm, Fernando Perez wrote: > > This doesn't seem normal to me when I watch some screencasts. > > If this is not normal behaviour, how can I figure out the source of > > the problem? > > Maybe they edited their videos to prevent wasting time watching rails > load? > -- > Posted viahttp://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rails is slow to load
Hi, I was just wondering if this was normal or not. I was running ruby 1.8.7 with rails 3 - rc. (Currently trying 1.9.2- rc2 but the same problem) It takes rails a while to load. (a while as in 10-15 seconds) It will take a while before I can use the console , or before running a test or starting up the server. This doesn't seem normal to me when I watch some screencasts. If this is not normal behaviour, how can I figure out the source of the problem? -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Migration: updating a column
Thanks. I was under the impression that change_column was only for renaming. On Jul 29, 9:19 am, Ar Chron wrote: > Have you tried change_column in a migration? > > http://api.rubyonrails.org/classes/ActiveRecord/Migration.html > -- > Posted viahttp://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Migration: updating a column
Hi, Is there a way to "update" a column? Here's what I mean: I have a column name "item" in table "products" of type "integer" Now I want to update the column to have the option ":null => false" So far, the only way I have found is to remove it and re-add it, but obviously that is quite dumb. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: how to update a single table cell using ajax
You can alwaus just do the following: -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Test - Skip Setup
Hi, I want to write a functional test using the default test unit that is included with rails 3. Is there a way to skip a setup call? So I'm trying to test the users controller. But to access those actions, I need to be logged in. So I put a login algorithm in my setup. But I do not need to be logged in to create a new user. This is why I want to skip the setup call. Eric -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Ruby on Rails 3 RC and files in "lib" directory
Hi, Ading config.autoload_paths += %W(#{config.root}/lib) to my application file solved it :) Thank you so much On Jul 27, 5:59 am, stephenjamesmurdoch wrote: > Hi Nicolas, i think I've fixed the problem > > add the following to your application.rb file: > > # Custom directories with classes and modules you want to be > autoloadable. > config.autoload_paths += %W(#{config.root}/lib) > > This code is generated when you create a brand new rails3rc app but > not when you create a rails3b4 one... > > Also, in your rakefile, change: > > Rails::Application.load_tasks > to > YourAppName::Application.load_tasks > > I could be wrong but I think it's fixed the problem for me > > Cheers > Steve > On Jul 27, 9:12 am, Nicolas Blanco wrote: > > > > > Steve Murdoch wrote: > > > sam problem here :( > > > > anyone know? > > > > I get: > > > > uninitialized constant ApplicationController::Authentication > > > > Obviously I could just move the methods from my lib/authentication.rb > > > file into application_controller.rb but I'd prefer to see if there's > > > another way first.. > > > Of course it's still possible to require manually files in "lib" but > > wanna know if that's a feature, not a bug :). > > -- > > Posted viahttp://www.ruby-forum.com/. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rails 3 - AJAX Response
Hi, I need help with some AJAX in rails 3. So basically, I have a select option in my index page for my User model. This select option is a form that modifies the user's type. The " :remote => true " works and the type is changed when hit the submit button. But, nothing happens in the browser. The user is updated. I'm actually not sure where to put either my JS / RJS file ( I've tried both, but neither do anything. ) So here's my code: The form: <%= form_for(@user, :remote => true) do |f| %> <%= f.select("type_id" , Type.all.collect{ |t| [t.name,t.id] } ) %> #TYPE is another model. User belongs_to Type <%= f.submit "Save" %> <% end %> The model: class UsersController < ApplicationController skip_before_filter :authorize, :only => [:new, :create] # GET /users # GET /users.xml def index @users = User.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @users } end end # GET /users/1 # GET /users/1.xml def show @user = User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @user } end end # GET /users/new # GET /users/new.xml def new @user = User.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @user } end end # GET /users/1/edit def edit @user = User.find(params[:id]) if params[:change_type] change_type end end # POST /users # POST /users.xml def create @user = User.new(params[:user]) respond_to do |format| if @user.save format.html { redirect_to(@user, :notice => 'User was successfully created.') } format.xml { render :xml => @user, :status => :created, :location => @user } else format.html { render :action => "new" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end # PUT /users/1 # PUT /users/1.xml def update @user = User.find(params[:id]) unless params[:user][:type_id] @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to(@user, :notice => 'User was successfully updated.') } format.js format.xml { head :ok } else format.html { render :action => "edit" } format.js format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end else respond_to do |format| if @user.update_attribute("type", Type.find_by_id( params[:user][:type_id] ) ) format.js{ head:ok} else format.js {head:ok} end end end end def change_type unless params[:change_type_value] if @user.category == 5 @user.category = 0 else @user.category = 5 end respond_to do |format| if @user.save format.html { redirect_to( users_path, :notice => "Sucessfully changed " + @user.name.titleize + "'s category" ) } format.js else format.html { redirect_to( users_path, :notice => "Failed to change " + @user.name.titleize + "'s category" ) } end end end end # DELETE /users/1 # DELETE /users/1.xml def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to(users_url) } format.xml { head :ok } end end end The Response: Started POST "/users/1" for 127.0.0.1 at Tue Jun 22 23:31:07 -0400 2010 Processing by UsersController#update as JS Parameters: {"commit"=>"Save", "authenticity_token"=>"OT1oYw/ cSiLrbT1w9PNu8A9u6v5eZy/bFxjbhEo3lbY=", "id"=>"1", "user"=>{"type_id"=>"1"}} User Load (0.9ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 1) LIMIT 1 CACHE (0.0ms) SELECT "users".* FROM "users" WHERE ("users"."id" = 1) LIMIT 1 Type Load (0.8ms) SELECT "types".* FROM "types" WHERE ("types"."id" = 1) LIMIT 1 Completed 200 OK in 347ms -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] SQLite - show html from entry
Hi, I have an entry in my database that has line breaks. I want those line breaks to actually appear as line breaks when the entry is displayed. So, I did something like: <%= string_var.sub("\n","":) %> It partially works. It actually replaces the < with < and the > symbol with >. Is there a work around this? Thank you, Eric -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.