[Rails] Re: evaluating expressions left to right

2012-12-23 Thread 7stud --
In this method call: meth1(meth2(meth3)) ...which value has has to be computed first so that meth1 can return? -- Posted via http://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

[Rails] Re: why do I have to refer to my attr_accessible as self.varname?

2012-12-22 Thread 7stud --
7stud -- wrote in post #1089991: > > And here is how to correct the problem: > > class Dog > def title=(val) > @title = val.capitalize > end > > def do_stuff > self.title = "mr." > title + " Dog" > end > end > > p

[Rails] Re: why do I have to refer to my attr_accessible as self.varname?

2012-12-22 Thread 7stud --
Frederick Cheung wrote in post #1089897: > > Because rails doesn't use individual instance variables to store your > attributes (whether they've been marked as attr_accessible makes no > difference) > > title = "foo" > > Doesn't work because ruby assumes that you want to assign to the local > varia

[Rails] Re: Setup Issues

2012-12-21 Thread 7stud --
You don't give any hint as to what went wrong. Have you tried the one click installer here: http://railsinstaller.org/ I wouldn't use windows for anything. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails

[Rails] Re: Changing Value of a constant

2012-12-21 Thread 7stud --
Nirav Bhatu wrote in post #1089902: > I am shocked that we can change the value of constant in ruby!! > What about this: class Dog def initialize(password) @secret = password end end d = Dog.new("flower52") puts d.instance_eval("@secret") --output:-- flower52 -- Posted via http://www.

[Rails] Re: find_by_sql - ActiveRecord - Help please.

2012-11-07 Thread 7stud --
Another example: data = Array.new(10, nil) p data --output:-- [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil] p data.size --output:-- 10 puts data[0].province --output:-- 1.rb:4:in `': undefined method `province' for nil:NilClass (NoMethodError) -- Posted via http://www.ruby-forum.com/

[Rails] Re: Why does Kernel define class_eval?

2012-10-13 Thread 7stud --
obj = Object.new obj.class_eval {} --output:-- 1.rb:2:in `': undefined method `class_eval' for # (NoMethodError) puts Kernel.instance_methods(false).include? :class_eval --output:-- false $ ruby --version ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0] $ rvm use 1.8.7 $ ru

[Rails] Re: Version issue with First App in Hartl Tutorial

2012-10-13 Thread 7stud --
Have you checked the free online version of the book for the latest updates? -- Posted via http://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-talk@googlegroups.c

[Rails] Re: in Rails, what is the main (global) scope called?

2012-09-26 Thread 7stud --
Methods attach themselves to whatever the current class is when they are defined. If self is a class when the method is defined, then the method becomes an instance method in that class. If self is not a class when the method is defined, then the current class is self's class. puts self puts

[Rails] Re: How is the Kernel module an ancestor of Object?

2012-09-26 Thread 7stud --
Dheeraj Kumar wrote in post #1077704: > It would be more correct to say that Object includes the Kernel module. > see http://ruby-doc.org/core-1.9.3/Object.html > When a class includes a module, ruby creates an anonymous class out of the module and inserts into the inheritance chain directly abov

[Rails] Re: method name resolution

2012-09-25 Thread 7stud --
John Merlino wrote in post #1077564: > For the method invocation expression o.m, Ruby performs name > resolution with the following steps: 1) first, it checks the > eigenclass of o for singleton methods named m. 2) If no method m is > found in the eigenclass, Ruby searches the class of the o for an

[Rails] Re: global methods under object supposedly unaccessible

2012-09-23 Thread 7stud --
1) Post the definition of private. 2) Execute this program: puts 'hello' 3) What conclusions do you draw from that? -- Posted via http://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

[Rails] Re: Why is this simple require failing?

2012-09-23 Thread 7stud --
> I've never seen that require in any gems on the web That's because most of the time when you require something, it is a gem, and gems are installed in specific directories that ruby searches when you require something. You can see a list of the directories ruby searches when you require some

[Rails] Re: Why is this simple require failing?

2012-09-23 Thread 7stud --
> Also to reference the class, I still needed to prefix the module name > which is also strange because I am requiring it! Look up the difference between 'require' and 'include'. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Gro

[Rails] Re: ruby koans don't understand the principle sandwhich code

2012-09-23 Thread 7stud --
> But I don't get the principle. There is no such principle as the Sandwich principle. The principle is Don't Repeat Yourself(DRY). So if you find yourself writing the same or similar code over and over again, try to figure out a way to extract the repeated part into a method. That way you c

[Rails] Re: (koans) uninitialized constant TriangleError

2012-09-23 Thread 7stud --
1) Very good. Now you should try to determine what "Ruby on Rails" is, and whether your questions have anything to do with Ruby on Rails. 2) Read a tutorial on ruby exception handling, or better yet buy the book "Beginning Ruby": http://beginningruby.org/ and read that before trying to do the

[Rails] Re: Version Confusion

2012-09-22 Thread 7stud --
1) Did you try shutting your command window and opening a new one and then typing rails --verson? 2) Post the value of your PATH environment variable. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"

[Rails] Re: Class, Module, Object

2012-09-22 Thread 7stud --
> Module.is_a?(Class) Module inherits from Object, Object is an instance of Class. > Object.is_a?(Module) Object is an instance of Class, Class inherits from Module. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby

[Rails] Re: Re: mark multiple results

2012-09-19 Thread 7stud --
Javier Quarite wrote in post #107: > Maybe this helps: > > http://api.rubyonrails.org/classes/Enumerable.html#method-i-group_by > http://railscasts.com/episodes/29-group-by-month > > You may do @users.group_by(&:id) ... but I'm not sure what you have in > Each user has a unique id, so what doe

[Rails] Re: multiple modules defining same method included into a class

2012-09-19 Thread 7stud --
>…looking for a module named Rendering in the ActionController > namespace, since that is the namesapce that Base is defined in??? module Rendering def greet puts 'hi' end end module ActionController class Base include Rendering end end obj = ActionController::Base.new obj.greet

[Rails] Re: mark multiple results

2012-09-19 Thread 7stud --
class User attr_accessor :id, :name def initialize(id, name) @id = id @name = name end end charlie = User.new(9, 'Charlie') fred = User.new(1, 'Fred') sally = User.new(3, 'Sally') @users = [ fred, fred, fred, sally, charlie, sally ] user_counts = Hash.new(0) @users.ea

[Rails] Re: Re: Re: Find the largest value of given 3 values

2012-09-18 Thread 7stud --
roh wrote in post #1076535: > if we want to get the highest 3 values , then how can we write the code > for > that .? data = [10, 20, 70, 60, 40, 30] ordered_data = data.sort_by {|num| -num} p ordered_data p ordered_data[0..2] --output:-- [70, 60, 40, 30, 20, 10] [70, 60, 40] -- Posted via ht

[Rails] Re: formats in action view base

2012-09-16 Thread 7stud --
Also, p Dog.ancestors --output:-- [Dog, Cat, Animal, Object, Kernel, BasicObject] -- Posted via http://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-talk@googleg

[Rails] Re: formats in action view base

2012-09-15 Thread 7stud --
7stud -- wrote in post #1076203: > > Modules that are included are inserted into the inheritance chain. > Where in the chain? > > > > module Cat > def greet > puts 'meow' > end > end > > class Animal > def greet > puts &#

[Rails] Re: formats in action view base

2012-09-15 Thread 7stud --
class Animal def greet puts 'hi' end end class Dog < Animal def greet super end end d = Dog.new d.greet --output:-- hi module Animal def greet puts 'hi' end end class Dog include Animal def greet super end end d = Dog.new d.greet --output:-- hi Modul

[Rails] Re: calling method on base intended to simulate initialize on instances?

2012-09-13 Thread 7stud --
1) class Dog module Cat puts 'hello' end end --output:-- hello 2) > Do all the methods of the module get copied over to base Never. 3) I don't know. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Ra

[Rails] Re: Create multiple records on model

2012-09-12 Thread 7stud --
<%= form_for @instruction_user, <%= f.text_field :remark_tl%> Have you tried: params[:instruction_user][:remark_tl]? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To pos

[Rails] Re: mattr_accessor inside a class

2012-09-11 Thread 7stud --
John Merlino wrote in post #1075232: > Rails extends Ruby with mattr_accessor (Module accessor). As Ruby's > attr_accessor generates getter/setter methods for instances, > mattr_accessor provide getter/setter methods at the module level. In > below example, you see that mattr_accessor declared in t

[Rails] Re: define_method vs module_eval

2012-09-11 Thread 7stud --
John Merlino wrote in post #1075500: > Rails code: > > Accessors.send :define_method, :"default_#{name}", &block > > Accessors.module_eval <<-METHOD, __FILE__, __LINE__ + 1 > def #{name} > @details.fetch(:#{name}, []) > end > > def #{name}=(value) > value = value.present? ? Array(value)

[Rails] Re: Rails Syntax Change

2012-09-09 Thread 7stud --
Derek Lin wrote in post #1075271: > Do you mean "#{base_title} | Home" is more efficient because it doesn't > create a new String object? > It certainly does create a new String object--that's what the quotes do; they tell Ruby, "Please create a new String object for me. The difference is that

[Rails] Re: Rails Syntax Change

2012-09-09 Thread 7stud --
Well, if you are getting posts on the mailing list, then I guess you don't get the edits, which are allowed for 15 minutes. I corrected that error in my post--right after I posted. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google

[Rails] Re: What module are the <% %> and <%= %> defined in?

2012-09-09 Thread 7stud --
ERB is a feature of ruby. See here: http://ruby-doc.org/stdlib-1.9.3/libdoc/erb/rdoc/ERB.html -- Posted via http://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

[Rails] Re: Rails Syntax Change

2012-09-09 Thread 7stud --
> New: <%= yield(:title) %> > Old: <%= @title %> @title is set in a controller, and to separate views from what goes on in a controller, you shouldn't set a title of an html page in a controller. The method yield(:title) looks for the value of a title variable in the view, which can be set lik

[Rails] Re: get & post methods in controller's test

2012-09-05 Thread 7stud --
Sorry, my tests were inside an integration('request') test: /spec/requests/dog_pages_spec.rb In my rails tutorial book, it says that inside a controller test, you can't use urls at all, e.g get '/about' get '/' ...you can only do: get 'actionA' get 'actionB' -- Posted via http://www.ruby-fo

[Rails] Re: problems following this tutorial

2012-09-04 Thread 7stud --
...as stated in the tutorial here: 3.2 Creating the Blog Application To begin, open a terminal, navigate to a folder where you have rights to create files, and type: $ rails new blog This will create a Rails application called Blog in a directory called blog. You can see all of the switches t

[Rails] Re: get & post methods in controller's test

2012-09-04 Thread 7stud --
> The problem isn't in the route, but in the strange behavior of get and > post, instance methods of ActionController::TestCase::Behavior My rspec tests seem to work as you would expect. I used a controller named Dogs to test the routes: require 'spec_helper' describe "Dogs Pages" do descr

[Rails] Re: get & post methods in controller's test

2012-09-03 Thread 7stud --
How about: controller :sessions do match '/login' => :login_create, :via => :post match '/login' => :login, :via => :get match '/logout' => :logout end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Gr

[Rails] Re: How can an rspec test for a view pass if there's no action for the view in the controller?

2012-09-03 Thread 7stud --
If you don't even know what the posts in this thread say, why bother posting anything? -- Posted via http://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-talk@goog

[Rails] Re: How can an rspec test for a view pass if there's no action for the view in the controller?

2012-09-02 Thread 7stud --
> It is not inconsistent. Okay, perhaps it's more correct to say that Rails is flat out wrong. Rails complains that I need an action when there isn't one, which is false. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "R

[Rails] Re: Trouble With db:migrate

2012-09-01 Thread 7stud --
How about trying: .../your_app$ bundle install And then .../your_app$ bundle exec rake db:migrate -- Posted via http://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 rubyonra

[Rails] Re: How can an rspec test for a view pass if there's no action for the view in the controller?

2012-09-01 Thread 7stud --
Thanks for the response Frederick Cheung. I don't like this 'default rendering', nor the misleading error message saying the action is missing--but I guess I'll have to live with it. A route and view is all that's necessary to render a page. -- Posted via http://www.ruby-forum.com/. -- You

[Rails] Re: How can an rspec test for a view pass if there's no action for the view in the controller?

2012-09-01 Thread 7stud --
> It's a feature of Rails. It's a problem if it causes problems. (Note: nothing in this post has anything to do with rspec.) For me, that routing behavior is causing problems. Here's why: if I add a route such as: get "static_pages/dog" ...and then enter the url http://localhost:3000/static_p

[Rails] Re: Parsing data and create records when app starts

2012-09-01 Thread 7stud --
> products list should be loaded into the view when > app starts. In Rails, apps don't start. Instead, web browsers send requests to urls, which your app then directs to the proper controller and action. So I would start by reading the Rails Guide about routing to figure out how to write simpl

[Rails] Re: How can an rspec test for a view pass if there's no action for the view in the controller?

2012-08-31 Thread 7stud --
So this is a route "problem"? -- Posted via http://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-talk@googlegroups.com. To unsubscribe from this group, send email t

[Rails] Re: How can an rspec test for a view pass if there's no action for the view in the controller?

2012-08-31 Thread 7stud --
Thanks for the response. Here is my routes.rb: SampleApp25::Application.routes.draw do get "static_pages/home" get "static_pages/help" get "static_pages/about" get "static_pages/contact" # The priority is based upon order of creation: # first created -> highest priority. # Sampl

[Rails] Re: How can an rspec test for a view pass if there's no action for the view in the controller?

2012-08-31 Thread 7stud --
ction[0m Yet here is my controller: class StaticPagesController < ApplicationController end Previously, I had actions in my controller, but I wanted to see if the tests would fail without the actions, and I fully expected them to fail, but they won't. I have everything at githu

[Rails] How can an rspec test for a view pass if there is no action for the view in the controller?

2012-08-30 Thread 7stud --
The rspec test looks like this: require 'spec_helper' describe "Static pages" do describe "Home page" do it "should have the h1 'Sample App'" do visit '/static_pages/home' page.should have_selector('h1', :text => 'Sample App') end end end My controller looks like th

[Rails] Re: retrieve app from github?

2011-09-22 Thread 7stud --
Chirag Singhal wrote in post #1023053: > First you have to setup your laptop for git usage similar to what you > had > done for your PC. > 1. Install Git > 2. Generate SSH keys > 3. Add your laptop's public key to your github account (you can add as > many > keys as you want, so do not modify your

[Rails] Re: warning: class variable access from toplevel

2011-09-22 Thread 7stud --
Open up spec_helper.rb and copy and paste lines 95-110. -- Posted via http://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-talk@googlegroups.com. To unsubscribe fro

[Rails] Re: retrieve app from github?

2011-09-21 Thread 7stud --
Thanks! -- Posted via http://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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+un

[Rails] retrieve app from github?

2011-09-20 Thread 7stud --
How do I retrieve a ruby app that I've pushed to github? I've been pushing as I've been developing on my pc, and now I want to get the app on my laptop, so I can develop on my laptop. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Googl

[Rails] Re: how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
I downloaded: git-1.7.6.1-x86_64-snow-leopard.dmg and went through the install wizard, but the command: $ git --version returned: git command not found But after I Quit Terminal, and reopened Terminal, I got: $ git --version git version 1.7.6.1 Thanks. -- Posted via http://www.ruby-forum

[Rails] Re: how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
Anyway, can someone confirm what git I am supposed to install? -- Posted via http://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-talk@googlegroups.com. To unsubscr

[Rails] Re: Re: how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
Walter Davis wrote in post #1022969: > On Sep 20, 2011, at 2:14 PM, 7stud -- wrote: > >> Xcode 4 isn't free, so I downloaded Xcode 3.2.6, and apparently it >> doesn't install git. > > I wonder why you would be seeing a price. I just looked in the Mac App >

[Rails] Re: Re: how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
leoncio caminha wrote in post #1022992: > its a apple pie dude > > http://code.google.com/p/git-osx-installer/downloads/list?can=3 > > and choose a version of Mac OS > Well...that's the problem. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed t

[Rails] Re: how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
Here: http://developer.apple.com/support/xcode/ it says: === Paid members of the Mac and iOS Developer Programs have access to the latest Xcode developer tools, SDKs, and pre-release software. Program members can download Xcode 4. Xcode 4.1 for Lion is available as a free download from the Ma

[Rails] Re: how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
Does xcode 4 work on osx 10.6.8? If so, where can I download it? -- Posted via http://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-talk@googlegroups.com. To unsub

[Rails] Re: how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
Robert Walker wrote in post #1022904: > Robert Walker wrote in post #1022903: >> We can't tell without knowing what hardware you are running. If you Mac >> has a 64 bit processor then install the x86_64 bit version. This is most >> likely the case. For example: the only MacBook Pro that was not 64

[Rails] Re: how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
Hardware Overview: Model Name: MacBook Model Identifier: MacBook2,1 Processor Name: Intel Core 2 Duo Processor Speed: 2.16 GHz Number Of Processors: 1 Total Number Of Cores: 2 L2 Cache: 4 MB Memory: 2 GB Bus Speed: 667 MHz Boot ROM Version: MB21.00A5.B07 SMC Version

[Rails] how do I install git on OSX 10.6.8?

2011-09-20 Thread 7stud --
git presents me with these choices: git-1.7.6.1-i386-snow-leopard.dmg git-1.7.6.1-x86_64-snow-leopard.dmg git-1.7.6-i386-snow-leopard.dmg git-1.7.6-x86_64-snow-leopard.dmg git-1.7.5.4-i386-leopard.dmg git-1.7.5.4-x86_64-leopard.dmg git-1.7.5.3-i386-leopard.dmg H

[Rails] Re: generating html files

2011-09-19 Thread 7stud --
Here is an example: require 'erb' require 'sqlite3' template = ERB.new <<"END_OF_TEMPLATE" <%= name %> div {color:blue;} Name: <%= name %> Color: <%= color %> END_OF_TEMPLATE db = SQLite3::Database.new( "my_db.db" ) table = "test" db.execute( "select * from #{table}" ) do |row| name

[Rails] Re: generating html files

2011-09-19 Thread 7stud --
"\"Jochen Kächelin - 8frogs.de\"" wrote in post #1022809: > what the recommended way to generate static html files based on a > database structure, for example 1000 product pages. > > i would like to specify s template and embed css styles. > > i use rails 3.1 > > thanx erb templates are part of

[Rails] Re: routing question

2011-09-19 Thread 7stud --
Slava Mikerin wrote in post #1022739: > Hello, > I wonder how to tell my routes.rb to route requests to a resource to > it's parent controller > > class Foo < Bar > end > > > resources :foos ===> controller :bars resources :foos, :controller => :bars -- Posted via http://www.ruby-forum.com/. -

[Rails] Re: partials and render_to_string

2011-09-18 Thread 7stud --
John Merlino wrote in post #1022569: > Hey all, > > This is my understanding of html and browsers. On the server, html is > plain text. When the browser sends request to server to fetch a > document, if the file is not already in html format, perhaps instead > in an rb file, ruby or whatever the s

[Rails] Re: Re: error with select helper

2011-09-17 Thread 7stud --
Colin Law wrote in post #1022477: > On 17 September 2011 20:49, 7stud -- wrote: >> --output:-- >> >> undefined method `id' for [1, 2]:Array (NoMethodError) > > I am not sure why you would expect anything else. @sub-seasons is an > array. The collect method pas

[Rails] Re: error with select helper

2011-09-17 Thread 7stud --
@sub_seasons = [ [1, 2], [10, 20], [100, 200] ] @sub_seasons.collect do |element| element.id end --output:-- undefined method `id' for [1, 2]:Array (NoMethodError) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "

[Rails] Re: Collecting failed validations

2011-09-17 Thread 7stud --
Well, then how about: if not user.valid? logger.info user.errors.full_messages end -- Posted via http://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-talk@google

[Rails] Re: Collecting failed validations

2011-09-17 Thread 7stud --
> So, I was thinking, wouldn't it be nice if Rails automatically > saved the attributes of an object to the database when > the validations fail? No, it wouldn't. Do you really want to have billions of records in your database from all the spam bots trying to log in? -- Posted via http://www.r

[Rails] Re: rjs error TypeError: element.getElementsByTagName is not a function in rails 3+jquery

2011-09-14 Thread 7stud --
Hassan Schroeder wrote in post #1021992: > On Wed, Sep 14, 2011 at 4:58 AM, Pab wrote: > >> RJS error: >> >> TypeError: element.getElementsByTagName is not a function > > Exactly what it says: getElementsByTagName is a basic JavaScript > function of *document*. So you need to look at your JS to se

[Rails] Re: rjs error TypeError: element.getElementsByTagName is not a function in rails 3+jquery

2011-09-14 Thread 7stud --
You probably should't use prototype methods when you've chosen jquery as your js framework. -- Posted via http://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-talk

[Rails] Re: Storing form data in xml file

2011-09-12 Thread 7stud --
> How can I use this model to write a CLI program, Well, you might offer random people $100 so that you can get them to read through all your specs. Then you can pay someone $5,000 to write the code for you. gl -- Posted via http://www.ruby-forum.com/. -- You received this message because

[Rails] Re: chunk

2011-09-12 Thread 7stud --
result = [2, 4, 1, 3, 5, 6, 8].chunk do |num| num.even? end result.each do |even_result, a_chunk| p [even_result, a_chunk] end --output:-- [true, [2, 4]] [false, [1, 3, 5]] [true, [6, 8]] e = DATA.chunk do |line| ascii_code_for_first_letter = line.ord end e.each do |ascii_code, lin

[Rails] Re: check_box not passing 0 when unchecked?

2011-09-12 Thread 7stud --
Dave Aronson wrote in post #1021425: > On Sun, Sep 11, 2011 at 23:37, Joan Gu wrote: > >> >> > name="schedule_report[active_17]"> >> ... >> >> Problem: >> The value of "1" is always passed, even if the box is UNCHECKED. >> Please help! > > Passed to your browser as evidenced by the above rend

[Rails] Re: check_box not passing 0 when unchecked?

2011-09-11 Thread 7stud --
Go read a basic html tutorial, concentrating on the syntax of an tag. -- Posted via http://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-talk@googlegroups.com. To

[Rails] Re: searching the an array of objects

2011-09-11 Thread 7stud --
Don't forget about that Enumerable link: u.matches.any? {|match| match.id == 2}.should be_false -- Posted via http://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-

[Rails] Re: installing ruby gems

2011-09-11 Thread 7stud --
And for some reason you thought it unimportant to list what directory you were at when issuing those commands? -- Posted via http://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

[Rails] Re: Finding HTML attributes with jQuery in Rails 3.1

2011-09-10 Thread 7stud --
Frederick Cheung wrote in post #1021129: > On Sep 10, 12:18pm, dwormuth wrote: >> "operations" )) %>").show() >> $("#services").html("<%= escape_javascript(render(:partial => foo )) >> %>").show() >> >> or >> >> $("#services").html("<%= escape_javascript(render(:partial => $ >> (this).data("sectio

[Rails] Re: Re: Ajax and rails 3 UJS (jquery)

2011-09-09 Thread 7stud --
Gordon Yeong wrote in post #1020881: > Hello, 7stud, > I followed your recommendations and I managed to get good results. > > When I define the return data and then not put any "render" in the > controller action, it works. > > -

[Rails] Re: TCPServer in 1.9.2

2011-09-08 Thread 7stud --
Spelled it correctly in the title. A good hint as to what was wrong: Object::TCPserver (NameError) Sometimes, if you know your code is right, but it still won't work, delete the offending line and retype it. -- Posted via http://www.ruby-forum.com/. -- You received this message because you a

[Rails] respond_with and ajax

2011-09-08 Thread 7stud --
Suppose I have this controller: class SalesController < ApplicationController respond_to ? def get_price @price = Product.find(params[:product_id]).price respond_with ? end end 1) What do I specify for respond_to() so that get_price() will accept ajax requests? 2) What d

[Rails] Re: jquery and ajax query in rails 3

2011-09-08 Thread 7stud --
Can you post the your form tag? -- Posted via http://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-talk@googlegroups.com. To unsubscribe from this group, send email

[Rails] Re: jquery and ajax query in rails 3

2011-09-07 Thread 7stud --
Why would you think prototype code would work in a jquery app? What version of rails are you using? What have you done to setup your app for jquery? Why did you think that information was unnecessary? Aren't you aware that rails changes every week? -- Posted via http://www.ruby-forum.com/.

[Rails] Re: Method get of ActionController::TestCase ignores routes.rb?

2011-09-07 Thread 7stud --
The following tests *do* work as expected: describe "GET 'contact'" do it "should be successful" do { :get => 'pages/contact' }.should be_routable end end describe "POST 'contact'" do it "should be successful" do { :post => 'pages/contact' }.should be_routable

[Rails] Re: Method get of ActionController::TestCase ignores routes.rb?

2011-09-07 Thread 7stud --
Dmitry Suzdalev wrote in post #1020600: > > Can anybody hint my why does this happen? I'm only starting learning > about > RoR :) Earlier it seemed to me that these 'get/post' methods of TestCase > do > respect routes.rb... > > Am I missing something obvious? :) > With this controller: class Pag

[Rails] Re: Good rails 3.1 book

2011-09-07 Thread 7stud --
Rodrigo Ruiz wrote in post #1020627: > is the Agile book written entirely in rails 3.1? Rails 3.1 was released last week. There are no rails 3.1 books. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"

[Rails] Re: before filter question

2011-09-07 Thread 7stud --
Anyone have any explanation for the behavior I'm seeing? -- Posted via http://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-talk@googlegroups.com. To unsubscribe fr

[Rails] Re: FactoryGirl doesnt produce unique names?!

2011-09-07 Thread 7stud --
> I checked the db and it has got 0 entries in > the countries table. Which db? -- Posted via http://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-talk@googlegroup

[Rails] Re: how it works with Proc object?

2011-09-07 Thread 7stud --
felix wrote in post #1020377: > def test > yield > end > yield() means: execute the block that is specified in the method call. > test do > p "a" > end > That syntax calls test() and everything after 'do' is a block, which ruby automatically passes to the method. Note that your definition o

[Rails] Re: Character encoding problems.

2011-09-06 Thread 7stud --
Perry Smith wrote in post #1020442: > I've been fighting these problems since I moved to Ruby 1.9. I am now > using Ruby 1.9.2 with Rails 2.3.11 and I am still having problems. The > symptom is errors with this message: > > (incompatible character encodings: UTF-8 and ISO-8859-1) > > I've marked

[Rails] Re: Ajax and rails 3 UJS (jquery)

2011-09-06 Thread 7stud --
1) I do this: <%= javascript_include_tag( "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js";, "jquery.rails.js" ) %> No gem needed. You can read here about the advantages of using a google link: http://encosia.com/3-reasons-why-you-should-let-google-host-j

[Rails] Re: form remove submit buton.

2011-09-05 Thread 7stud --
Good luck using java. -- Posted via http://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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyo

[Rails] Re: How to iterate an array of hashes and return the interested array

2011-09-05 Thread 7stud --
Well, it looks to me like you have an outer hash with key/values, and a value is an array of hashes, so you would do this: main_hash["items"][1]["title"] ==> 'xyz' main_hash["items"][1]["title"] ==> 'xyz' ^ ^ | | array | |

[Rails] Re: How to iterate an array of hashes and return the interested array

2011-09-05 Thread 7stud --
That isn't valid ruby syntax. Are you trying to parse a file with that syntax? -- Posted via http://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-talk@googlegroup

[Rails] Re: Form helper: attribute as an array

2011-09-05 Thread 7stud --
Huh? -- Posted via http://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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsub

[Rails] Re: How do I make "rake db:migrate" work properly?

2011-09-05 Thread 7stud --
Miquel Cubel wrote in post #1020180: > Hi, > > With rails 3.1 and some new gems versions the books can become > complicated. > > There are better ways to do it, but in your case (starting from > zero) I'll suggest: > > 1. Delete new versions of rails: > gem uninstall rails > >

[Rails] Re: How do I make "rake db:migrate" work properly?

2011-09-05 Thread 7stud --
Frederick Cheung wrote in post #1020189: > On Sep 5, 8:48am, 7stud -- wrote: >> rake db:migrate >> >> The whole idea behind Bundler and your Gemfile is to specify which gems >> you want to use for your app. To use the gems in your Gemfile when >> executing

[Rails] Re: same html elements rendering twice on page

2011-09-05 Thread 7stud --
It seems to me that the = sign in haml is arbitrary and capricious. For instance, how does the syntax: - wrap do - page_title "Teams List View" result in anything being added to the page? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to

[Rails] Re: same html elements rendering twice on page

2011-09-05 Thread 7stud --
By the way, if you put some html at the top of the page, e.g. %p Index.html.haml - wrap do - page_title "Teams List View" Your wrap() method will double render the whole page. Based on my experiments with haml, I would never consider using a multiline ruby block that contains a rails helper.

[Rails] Re: same html elements rendering twice on page

2011-09-05 Thread 7stud --
What happens if you get rid of concat()? -- Posted via http://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-talk@googlegroups.com. To unsubscribe from this group, s

[Rails] Re: How do I make "rake db:migrate" work properly?

2011-09-05 Thread 7stud --
Curiously, you listed the versions of every program except the one that is throwing the error. > I've gone through the exercises in chapter 2 with no problems. Not very helpful for people who don't have the book. I don't know if this is your problem or notbut in any case you should never

  1   2   3   4   5   >