I thought the ? matches zero or one occurrence of a pattern. However in
this example:
def show_regexp(string, pattern)
match = pattern.match(string)
if match
#{match.pre_match}-#{match[0]}-#{match.post_match}
else
no match
end
end
a = The moon is made of cheese
show_regexp(a,
I have the production and staging site on two different server ips. But the
database, another server ip, is the same database used by both production
and staging. When i set up the capistrano deploy task for both the
production and staging, should I keep the db role in deploy.rb like this:
I have a production server and a staging server and a production git
branch and a staging git branch for the same repository on github. The
production git branch and staging git branch are identical. I got my
staging server running and during the second deploy, something unexpected
started
I have another application publishing messages to redis server. Within my
rails application, when a user clicks a button, I want a popup to display
that shows live updates. I want the controller to publish notifications to
redis, and I want my javascript to subscribe to those events and respond
Initially, I was using this query:
report_ids = []
if units.size 0
units.map(:id).uniq.each do |id|
report_id = Report.select(:id).where(unit_id: id).order(time
desc).first
unless report_id.nil?
report_ids report_id
end
end
end
I have the following setup:
class Unit
has_many :reports
end
class Report
belongs_to :unit
end
Basically I have a list of units and I want to select the last report for
each unit (based on time) and order the resulting last reports by longitude.
Sounds simple, but my implementation looks
self-joins are discussed here:
http://guides.rubyonrails.org/association_basics.html#self-joins
self-referential association is discussed here:
http://railscasts.com/episodes/163-self-referential-association
The main difference I see is that self-referential association creates a
join model,
I have severe bloat, spending most of the day killing rack processes on my
server. I need to figure out the cause. Most likely too many activerecord
objects allocated in memory, to the point that rock process exceeds 1 gig
of private dirty memory. Should I use Rack::Bug, MemoryLogic or Oink on
I'm using Rails 3, Passenger, and Postgresql. Yesterday the rails
application was running very slow. So I rebooted the server. Less than 24
hours later, it is consuming even more memory than before and when trying
to load the web page, it just hangs forever. I ran passenger-memory-stats
to
unit.created_at.class
= ActiveSupport::TimeWithZone
Time.zone.now.class
= ActiveSupport::TimeWithZone
Time.zone.now - unit.created_at
= 47709736.32316899
I think that's the number of seconds that have passed between when the unit
was created and the current time. Is this correct? If
When using DateTime.now, does the now method return the time based on the
remote OS system time or the local time where the user actually invoked the
now method, if they are using ssh and running the commands in a rails
console, for example?
--
You received this message because you are
For this one particular project, rails is not to logging controller,
action, parameters, complection time, etc in development mode. And I am not
sure why.
When I check in the console the log level I notice:
Rails.logger.level
= 0
So I am not sure why it doesn't log the information it
Is there any advantages of installing rvm system-wide as opposed to just in
the home directory of a user?
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
When I view the output of the top command on ubuntu, I notice sometimes
there is 6 ruby processes. When are each of these processes spawned?
http://tinypic.com/view.php?pic=2i24rwhs=5
I cannot imagine that it's every time someone loads the rails application
from a different ip address,
I run cap deploy:setup
And towards the end, I see the following issues:
** [out :: xxx.xx.xx.132] Unrecognized command line flag:
'--autolibs=read-only' ( see: 'rvm usage' )
** [out :: xxx.xx.xx.134] Already installed ruby-1.9.3-p0.
** [out :: xxx.xx.xx.134] To reinstall use:
I have two hex values and expect back the value 3007
What pack does is take the array of hexes and formats them into a string
(if ASCII representation, then ASCII character, otherwise the raw hex as
string). Then I take the string of hexes and unpack them, that is, get the
unsigned int
I installed spree by adding it in gemfile. It was giving me errors, so I
went to the github site, and installed spree using gem install spree. But
now it looks like i have two sets of gems for the dependencies of spree:
spree_api (2.0.3, 0.40.0)
spree_auth (0.40.0)
spree_backend (2.0.3)
I was using this code
url = http://#{agent_host}:#{agent_port}/home/create_unit?;
And it worked fine in development but for my config.yml, I was
specifying localhost for agent_host. However in production, agent_host
is an actual ip address and it just wouldn't work. So I had to
From my understanding, you can pass a block to the link_to helper, but
the following code gives me an error undefined method
`stringify_keys' for #String:0x007fe8a3ba0a48.
= link_to(One time Payment with Paypal or Credit Card,
@order.payment_payment_standard_url(new_order_url(invoice:
Most implementations of shopping carts I have seen is that a user
stores line items in a cart, where the line items represent products
or subscriptions. So a cart has many products through line items and a
product can have many carts through line items. Then a customer makes
an order and so you
I'm careful to create separate gemsets for each project, so when I run
bundle install, it only installs gems for that gemset. This way gems
dont creep into the wrong projects. Now I just pulled a project from
github. I made sure I was in the correct gemset, and then I run bundle
install and it
I'm not sure why but I have both a staging and production deploy using
the 'capistrano/ext/multistage' gem. I set staging to the default:
set :stages, [staging, production]
set :default_stage, staging
It deploys correctly to the right path:
#deploy/staging.rb
set :deploy_to,
When I ran cap deploy:setup, the following actually installed rvm,
ruby and the online_store gemset on my staging server:
set :rvm_ruby_string, 'ruby-1.9.3-p0@online_store'
set :rvm_autolibs_flag, read-only
set :rvm_type, :system
set :rvm_install_with_sudo, true
before 'deploy:setup',
I was following these instructions for capistrano deployment:
https://github.com/capistrano/capistrano/wiki/2.x-From-The-Beginning
Under the section Application Layer Initialization, it says:
We need to tell Capistrano how to “spin up” (start) our application
layer. The precise way this works
How do you know which patch level to use for ruby? I have one project that
uses ruby-1.9.3-p0. When I cd into another project, it
says: ruby-1.9.3-p392 is not installed. So which to use: ruby-1.9.3-p0
or ruby-1.9.3-p392?
--
You received this message because you are subscribed to the Google
cap deploy?
On May 14, 12:53 pm, Walter Lee Davis wa...@wdstudio.com wrote:
On May 14, 2013, at 12:37 PM, John Merlino wrote:
How do you know which patch level to use for ruby? I have one project that
uses ruby-1.9.3-p0. When I cd into another project, it says:
ruby-1.9.3-p392
? Obviously I want
different gemsets for different projects to manage with bundler. But
patch levels?
On May 14, 1:06 pm, John Merlino stoici...@aol.com wrote:
I'm using capistrano. I added this to the recipe:
set :rvm_ruby_string, 'ruby-1.9.3-p0@online_store' # use
the same ruby
I assume this is the most up to date documentation for running bundler
install when deploying a rails application with capistrano:
http://gembundler.com/v1.3/deploying.html
In the documentation, it offers two methods for deploying capistrano
with bundler: manual vs automatic.
Which is
In the capistrano wiki, it contains this line:
set :scm_username, “foo”. If you access your source repository with a
different user name than you are logged into your local machine with,
Capistrano needs to know.
Actually the way I access my repository through my app is through ssh
keys. The
I'm looking at the documentation:
http://ruby-doc.org/stdlib-2.0/libdoc/net/http/rdoc/Net/HTTP.html
And I notice two uses of Net::HTTP. Both are using GET requests. But
what's the difference? When to use which?
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new uri
?
On Sunday, May 5, 2013 10:41:01 AM UTC-4, Colin Law wrote:
On 5 May 2013 00:30, John Merlino stoi...@aol.com javascript: wrote:
Which of these scripts is preferred to install rvm on ubuntu server:
curl -#L https://get.rvm.io | bash -s stable --autolibs=4 --ruby
I don't think-#L is a good idea
Which of these scripts is preferred to install rvm on ubuntu server:
curl -#L https://get.rvm.io | bash -s stable --autolibs=4 --ruby
curl -L get.rvm.io | bash -s stable --auto
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To
when you add a gem to the Gemfile and then run bundle install, where
does the command look for the gem? If you had gem 'rails', :git =
'github.com/rails/rails.git, I assume it would update your
system .rvm gems directory with the latest github commits. But what is
the default repository that
From my understanding, Gemfile.lock lists all the gems installed for
the application along with the specific versions used. This means your
app will only use the versions mentioned here and no others, even if
updates for those gems are available. When you are deploying your
application to staging
There's a common problem when you run bundle install and it tries to
install the msql2 gem but fails when mysql itself is not installed on
the machine. What if you have mysql installed on a different machine
(because you don't want your web application which is accessible to
the public and your
Quick question. Often I add a gem to my Gemfile and then run bundle
install and I notice that it installs a bunch of other stuff (in
addition to what I wanted):
Installing warden (1.2.1)
Installing devise (2.2.3)
Installing fastercsv (1.5.5)
Installing formtastic (2.2.1)
Installing has_scope
So this means I don't need to add devise to my Gemfile now and run a
bundle because devise is already isntalled and fully functioning in my
app?
On Apr 23, 6:17 pm, Scott Ribe scott_r...@elevated-dev.com wrote:
On Apr 23, 2013, at 3:52 PM, John Merlino wrote:
Does this mean that the gem I
This guy is using godaddy shared hosting for his wordpress blog. I
think it's currently $5 a month. I was thinking to use Rails for his
next project. But I wouldn't want costs to exceed more than $20 per
month. I contacted heroku and they said that 1 dyno is free to host
your ruby on rails app and
This guy is using godaddy shared hosting for his wordpress blog. I
think it's currently $5 a month. I was thinking to use Rails for his
next project. But I wouldn't want costs to exceed more than $20 per
month. I contacted heroku and they said that 1 dyno is free to host
your ruby on rails app and
In console, I run the following and any? returns true:
drivers = Driver.select(drivers.*,
drivers.id).joins([:reports, :driving_habits]).where(extract(MONTH
FROM reports.time) = ? AND extract(YEAR FROM reports.time) = ?, 3,
2013).uniq.order(drivers.id asc).page(2).per(1)
drivers.any?
= true
This
I came across some posts which postulate that it's undesirable to
share helper methods across controller and views because UI code
(designed to render HTML) should be separate from controller code
(designed for handling requests). That makes sense but there are
times, a good example is filtering,
User wrote:
Norm Scherer wrote in post #1102294:
On 03/18/2013 10:37 AM, John Merlino wrote:
Is there a good practice when to use the session variable. Sometimes I
find myself using both the session variable and instance variable. For
example, I have a table that allows a user
I have this query:
Report.
joins(:alerts).
joins(:alert_code).
where(:unit_id = unit_id).
where{time my{self.time}}.
where(alert_codes.name LIKE ?, %Inside virtual
fence%).
Is there a good practice when to use the session variable. Sometimes I find
myself using both the session variable and instance variable. For example,
I have a table that allows a user to select a date. I store the date both
in the session and in the instance variable. Should I not bother to
render_to_string returns the result of executing some template or
partial in a string instead of sending it as the response body to the
browser. Render returns the result of evaluating some template or
partial as a string of html, like render_to_string, but it then sends
it back as part of the
I know that Rails output log shows how many milliseconds a sql query
take but I'm looking for something more fine-tuned. I want to know how
long individual activerecord queries take on an indiivdual basis. For
example, I have code that looks like this:
items =
That was my hunch. Thanks for clarifying.
On Wednesday, December 26, 2012 6:48:18 PM UTC-5, Matt Jones wrote:
On Tuesday, 25 December 2012 20:13:16 UTC-5, John Merlino wrote:
ok, it didn't look like nested methods. But I made to believe that
this:
sum=square*deviation|a
is exactly
ok, it didn't look like nested methods. But I made to believe that
this:
sum=square*deviation|a
is exactly the same as this:
sum=(square*(deviation|(a)))
So if this is true, then still a question remains.
Here's the original context again:
module Functional
def compose(f)
if
Here are two methods defined in the Proc class, designed to be used
for functional programming:
def apply(enum)
enum.map self
end
alias | apply
def reduce(enum)
enum.inject self
end
alias = reduce
Here's an application of them:
sum = lambda {|x,y| x+y }
mean =
root of it.
So I guess the lesson here is not only do parentheses indicate
priority in evaluating an expression, but the expressions next to the
ones in parentheses are evaluated before starting to evaluate from
left to right.
On Dec 22, 10:10 am, John Merlino stoici...@aol.com wrote:
Here
class Proc
def apply(enum)
enum.map self
end
alias | apply
def reduce(enum)
enum.inject self
end
alias = reduce
def compose(f)
if self.respond_to?(:arity) self.arity == 1
lambda {|*args| self[f[*args]] }
else
lambda {|*args| self[*f[*args]] }
end
end
I come across this method:
read(n=nil, buffer=nil) – read n bytes (or fewer, if EOF is reached),
blocking if necessary, until the bytes are ready.
What does it mean blocking if necessary? Blocking what?
--
You received this message because you are subscribed to the Google Groups Ruby
on
In this example:
1.9.3p0 :001 def threading
1.9.3p0 :002? i = 0
1.9.3p0 :003? while i = 50
1.9.3p0 :004? sleep(2)
1.9.3p0 :005? i += 1
1.9.3p0 :006? if i == 50
1.9.3p0 :007? puts the thread is finished at #{Time.now}
1.9.3p0 :008? end
1.9.3p0 :009? end
1.9.3p0
Oh I see, because of the call to Kernel.sleep forces the thread in a
sleeping state.
On Oct 25, 9:55 pm, John Merlino stoici...@aol.com wrote:
In this example:
1.9.3p0 :001 def threading
1.9.3p0 :002? i = 0
1.9.3p0 :003? while i = 50
1.9.3p0 :004? sleep(2)
1.9.3p0 :005? i += 1
One shortcoming of define_method is that it does not allow you to
specify a method body that expects a block. If you need to dynamically
create a method that accepts a block, you will need to use the def
statement within class_eval. Here's a trivial example:
class Module
def acts_as_thing(name,
First, I'd like to say it makes sense to define instance_eval in
BasicObject. Both object instances (e.g. obj = Object.new or obj =
MyClass.new) and class objects (e.g. MyClass = Class.new) are both
instances of a class, in the former of the class Object or a client-
defined class (which
Let's say I want to check if a method of an object is an instance
method or a singleton method, what is the best way to do it?
--
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
The ruby documentation says instance_variable_set is a public instance
method of Object:
http://ruby-doc.org/core-1.9.3/Object.html#method-i-instance_variable_set
And I believe it because you can call it on instances of Object:
1.9.3p0 :005 Object.new.instance_variable_set :@a, 1
= 1
It
I notice how Rails makes heavy use of YAML serialization, but a lot of the
Ruby literature I come across places emphasis on Marshal. One powerful
technique with marshal is the marshal_dump and marshal_load hooks used to
customize storing and retrieving object states. For example, let's say I
I was reading this:
these methods allocate a new instance of the class of the object on
which they are invoked. They then copy all the instance variables and
the taintedness of the receiver object to the newly allocated object.
What does it mean taintedness?
thanks for response
--
You
Why can't a class be an instance of class Class and also inherit from
class Class in ruby?
Let's say I defined a singleton method on Class:
1.9.3p0 :032 class Class
1.9.3p0 :033? def Class.class_singleton
1.9.3p0 :034? puts 'class singleton'
1.9.3p0 :035? end
1.9.3p0 :036? end
And
I read this article:
http://www.madebydna.com/all/code/2011/06/24/eigenclasses-demystified.html
Author makes claim that are flat out wrong. She says: Class gets
pushed up the lookup chain and becomes a superclass. That statement
is flat out wrong. A class object does not inherit from class
I just want to make a note of something I read here:
http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Classes#Protected
def =(other)
self.age = other.age
end
It says:
If age is private, this method will not work, because other.age is
not accessible. If age is protected, this will
= Class
Class inherits from Module, which inherits from Object Class.superclass
= Module
Module.superclass
= Object
So, every instance of the Class class is_a?(Class) and is_a?(Module) and
is_a?(Object).
2012/9/22 John Merlino stoici...@aol.com
reload!
Reloading
to Class's singleton methods, but since Object,
Class, and Module are instances of Class class, they all have
access to Class's instance methods:
On Oct 3, 11:08 pm, John Merlino stoici...@aol.com wrote:
Yes, Object, Class, and Module are more than just constants. Object,
Class, and Module
A private method is internal to the implementation of a class, and it
can only be called by other instance methods of the class (or its
subclasses). Private methods are implicitly invoked on self, and may
not be explicitly invoked on an object. If m is a private method, then
you must ibnvoke it in
I know that Struct class defines the [] instance method:
1.9.3p0 :014 Struct.instance_methods(false)
=
[:==, :eql?, :hash, :inspect, :to_s, :to_a, :values, :size, :length, :each,
:each_pair, :
[], :
[]=, :select, :values_at, :members, :pretty_print, :pretty_print_cycle,
:as_json]
This allows
Top-level methods or constants defined outside of any class or module
are implicitly defined in Object.
On Sep 21, 1:30 pm, John Merlino stoici...@aol.com wrote:
For example, you see filescalled
rails/actionpack/lib/action_controller/base.rb
which adds methods and such to the open module
inheritance chain:
Class - Module - Object
Kernel.is_a?(Module) # = true
Kernel is an instance of Module, which in turn inherits from Object.
So how is Kernel an ancestor of Object?
I found it on line 262 of The Ruby Programming Language:
The Kernel module is an ancestor of Object.
--
You
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
instance method named m. 3) If no method m
The answer is that when Ruby searches for singleton methods in the
eigenclass of an object, it also searches the superclass (and all
ancestors) of the eigenclass as well.
On Sep 25, 11:05 pm, John Merlino stoici...@aol.com wrote:
For the method invocation expression o.m, Ruby performs name
documentation:
By default, all methods in Ruby classes are public - accessible by
anyone. There are, nonetheless, only two exceptions for this rule: the
global methods defined under the Object class, and the initialize
method for any class. Both of them are implicitly private.
class Object
reload!
Reloading...
= true
puts Class Module
true
= nil
puts Module Class
false
= nil
puts Module Object
true
= nil
puts Object Module
false
= nil
Object.parent
= Object
The above indicates that the Class object instance inherits from the
Module object instance and the Module object
For example, you see files called
rails/actionpack/lib/action_controller/base.rb
which adds methods and such to the open module ActionController. What
scope is ActionController in? Is it just called the global scope?
Obviously, there is namespace resolution lookup. And a good example of
this is
1.9.3p0 :003 class A
1.9.3p0 :004? end
1.9.3p0 :009 A.is_a?(Module)
= true
1.9.3p0 :010 A.is_a?(Class)
= true
1.9.3p0 :011 Class.is_a?(Module)
= true
class is module, so answer is append_features is run
On Sep 20, 1:23 am, John Merlino stoici...@aol.com wrote:
append_features(mod
.
On Sep 20, 8:11 pm, John Merlino stoici...@aol.com wrote:
1.9.3p0 :003 class A
1.9.3p0 :004? end
1.9.3p0 :009 A.is_a?(Module)
= true
1.9.3p0 :010 A.is_a?(Class)
= true
1.9.3p0 :011 Class.is_a?(Module)
= true
class is module, so answer is append_features is run
On Sep 20, 1:23
:016? include B
1.9.3p0 :017? include C
1.9.3p0 :018? end
= A
1.9.3p0 :019 A.new.name
c module
= nil
On Sep 18, 9:14 am, Matt Jones al2o...@gmail.com wrote:
On Monday, 17 September 2012 21:04:58 UTC-4, John Merlino wrote:
In Ruby, classes are never closed: you can always add methods
append_features(mod)
The documentation says:
When this module is included in another, Ruby calls append_features in
this module, passing it the receiving module in mod. Ruby’s default
implementation is to add the constants, methods, and module variables
of this module to mod if this module has
rescue StandardError
puts Here 4 - Other error encountered (#{$!.inspect}) +
caller.inspect
raise
else
puts 'Here 5 - No errors'
ensure
puts 'Here 6 - Always done'
end
On Sep 16, 4:02 pm, Frederick Cheung frederick.che...@gmail.com
wrote:
On Sunday, September 16, 2012 7:57:44 PM UTC+1, John
In Ruby, classes are never closed: you can always add methods to an
existing class. This applies to the classes you write as well as the
standard, built-in classes. All you have to do is open up a class
definition for an existing class, and the new contents you specify
will be added to whatever's
ActionController::Rendering and the fact that
ActionController::Rendering is included in ActionController::Base make
AbstractController::Rendering being included in ActionController::Base
redundant?
On Sep 17, 9:04 pm, John Merlino stoici...@aol.com wrote:
In Ruby, classes are never closed: you can always
I often see custom Exception classes inheriting from StandardError.
Errors which you can generally deal with are subclassed from
StandardError:
module AbstractController
class Error StandardError #:nodoc:
end
class ActionNotFound StandardError #:nodoc:
end
unless action_name =
But in the exampels I provided in the initial post that was not the
case. ActionNotFound, for example, had no implementation of its own.
It seems to be a waste of memory allocation.
On Sep 16, 2:57 pm, John Merlino stoici...@aol.com wrote:
I often see custom Exception classes inheriting from
When you invoke ActionView::Base, it in turn invokes a LookupContext
object. The LookupContext class object has some class level macros
that builds some instance methods corresponding to a format:
register_detail(:formats) { ActionView::Base.default_formats ||
[:html, :text, :js, :css,
question is
if it's true that a call to super in an instance method will call the
method in an included module of the same name, as shown in the example
provided above, with detailed descriptions.
On Sep 15, 2:25 pm, John Merlino stoici...@aol.com wrote:
When you invoke ActionView::Base
class A
def initialize
setup_b
setup_c
end
def b_and_c
#{@b} and #{@c}
end
private
def setup_b
@b = 'b'
end
def setup_c
@c = 'c'
end
def setup_d
@d = 'd'
end
end
a = A.new
a.instance_variable_get(@b) # = b
a.instance_variable_get(@c) # = c
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) : default_#{name}
_set_detail(:#{name}, value)
, John Merlino stoici...@aol.com wrote:
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
self is
ActionView with tha tmodule included.
On Sep 8, 3:51 pm, John Merlino stoici...@aol.com wrote:
Yeah so I would like to see the returned array of instance methods of
field_helpers of FormBuilder. I try to return it in console:
1.9.3p0 :016 FormBuilder.field_helpers
NoMethodError
What module of ActionView are the % % and %= % defined in?
--
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
ok ActionView::Base includes this module ::ERB::Util and ERB class
seems to do so
On Sep 9, 1:53 pm, John Merlino stoici...@aol.com wrote:
What module of ActionView are the % % and %= % defined in?
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails
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 the class
context of LookupContext. It's
The title of this message is wrong. LookupContext must have a
constructor:
ActionView::LookupContext.new(nil)
= #ActionView::LookupContext:0x007f8e84755d18 @details_key=nil,
@details={:handlers=[:erb, :builder, :coffee], :formats=[:html, :text, :js,
:css, :ics, :csv, :xml, :rss, :atom, :yaml,
initialize_details(details)
end
It's after 3 module definitions of the same class. It seems almost
intentionally designed to be confusing.
On Sep 9, 3:25 pm, John Merlino stoici...@aol.com wrote:
The title of this message is wrong. LookupContext must have a
constructor:
ActionView::LookupContext.new
I'm going to invoke action view base from console, passing a string
object:
1.9.3p0 :016 ActionView::Base.new('app/views')
= #ActionView::Base:0x007fd95c5e8f48 @_config={},
@view_renderer=#ActionView::Renderer:0x007fd95c5e8c50
@lookup_context=#ActionView::LookupContext:0x007fd95c5e8ed0
In the example below, what is the dash doing between the class
attribute and array:
(field_helpers -
[:label, :check_box, :radio_button, :fields_for, :hidden_field,
:file_field]).each
do |selector|
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails:
that method
exists on the FormBuilder class:
class_attribute :field_helpers
On Sep 8, 2:49 pm, Jordon Bedwell envyge...@gmail.com wrote:
In ruby a minus on an array removes elements. So its removing elements
from the array.
On Sep 8, 2012 1:42 PM, John Merlino stoici...@aol.com wrote
Without going to detail, I'll just show important code:
text field is passed the name of object, could be a symbol (:user) or
string (user[]). method is datbase attribute or virtual attribute.
the options hash, among other things, includes the object if persisted
(e.g. @user).
def
On here:
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-check_box-label-Gotcha
you see this code:
%= fields_for project[invoice_attributes][], invoice, :index = nil
do |form| %
%= form.check_box :paid %
...
% end %
why are they using :index = nil in the
/MatchData.html#method-i-pre_match
On Thursday, September 6, 2012 1:40:31 AM UTC-4, John Merlino wrote:
I looked in ruby documentation
http://www.ruby-doc.org/core-1.9.3/Regexp.html
I cannot find a method called pre_match but its used in Rails...
@template.instance_variable_get
1 - 100 of 394 matches
Mail list logo