thanks for response
On Sep 6, 5:32 am, Frederick Cheung frederick.che...@gmail.com
wrote:
On Thursday, September 6, 2012 2:39:00 AM UTC+1, John Merlino wrote:
module ActionView
module Helpers
module FormHelper
def form_for(foo, bar)
instantiate_builder(foo, bar
executes the block only after ActionView is loaded and then yields
ActionView to the block so that default_form_builder will become a
class method on ActionView, which returns the FormBuilder class
object.
On Sep 6, 11:46 am, John Merlino stoici...@aol.com wrote:
thanks for response
On Sep 6
module ActionView
module Helpers
module FormHelper
def form_for(foo, bar)
instantiate_builder(foo, bar)
end
def instantiate_builder(foo,bar)
self
end
end
end
end
self in instantiate_builder refers to
ActionView::Helpers::FormHelper. self it
I was looking in the Rails source code, and during the call to
form_for, it creates a new instance of FormBuilder and during the
initialization, it checks if the options hash contains an index:
@default_options = @options ? @options.slice(:index, :namespace) :
{}
When will the options hash
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(@#{Regexp.last_match.pre_match})
--
You received this message because you are subscribed to the Google Groups Ruby
on
I would like to bump this. Simple question. When will the first
element of an array passed as first argument to form_for ever be an
instance of RoutesProxy? The rails source looks for this, so I am sure
someone out there has examples.
On Sep 3, 2:05 pm, John Merlino stoici...@aol.com wrote:
when
when passing an array as first argument to form_for, polymorphic_url
checks if first index is an instance of
ActionDispatch::Routing::RoutesProxy:
def polymorphic_url(record_or_hash_or_array, options = {})
if record_or_hash_or_array.kind_of?(Array)
record_or_hash_or_array =
The ActionView module is declared several times in the Rails source:
rails/actionpack/lib/action_view/base.rb,rails/actionpack/lib/
action_view/buffers.rb,rails/actionpack/lib/action_view/digestor.rb,
rails/actionpack/lib/action_view/helpers/asset_tag_helpers/
asset_paths.rb, and the list goes on
In polymorphic_routes.rb, polymorphic_url is defined in rails source
from github,and this particular line:
inflection = if options[:action] options[:action].to_s == new
args.pop
:singular
elsif (record.respond_to?(:persisted?) !record.persisted?)
In ActionDispatch::PolymorphicRoutes, there is a call to
build_named_route_call an on line 172 (of latest rails code from
github), there is a call to singular_route_key:
model_name_from_record_or_class(parent).singular_route_key
Now model_name_from_record_or_class returns an ActiveModel::Name
In polymorphic_routes.rb, line 131, a name route that has been built
(e.g. post_users_path) gets invoked on self (assuming there was not
RoutesProxy instance appended as the first element of the array passed
as the first argument to form_for, then send() would be invoked on
self, which is
Yes, it is a basic feature of ruby that you can reopen a class
definition. I forgot about that.
On Sep 3, 4:05 pm, Colin Law clan...@googlemail.com wrote:
On 3 September 2012 19:08, John Merlino stoici...@aol.com wrote:
The ActionView module is declared several times in the Rails source
Oh, I figured this one out. Reason why the else doesn't pop the last
element is because the last element is the object passed to form_for
that has been persisted, and that element is needed in the array for
the id value when we invoke send on the dynamic route generated.
On Sep 3, 2:57 pm, John
On line 1152 of form_helper.rb, there is this line:
def default_form_builder
builder = ActionView::Base.default_form_builder
builder.respond_to?(:constantize) ? builder.constantize :
builder
end
I tried searching for default_form_builder on ActiveView::Base
On line 1152 of form_helper.rb, there is this line:
def default_form_builder
builder = ActionView::Base.default_form_builder
builder.respond_to?(:constantize) ? builder.constantize :
builder
end
I tried searching for default_form_builder on ActiveView::Base
Ok, nevermined, it appears when Active support loaded, its defined as
a class method on actionview:
ActiveSupport.on_load(:action_view) do
cattr_accessor(:default_form_builder)
{ ::ActionView::Helpers::FormBuilder }
end
On Sep 2, 12:57 pm, John Merlino stoici...@aol.com wrote:
On line
There's a number of calls in the Rails source to convert_to_model,
which takes an activerecord object instance:
convert_to_model(object)
Here's the thing. All convert_to_model does is calls to_model, which
returns self (the ActiveModel instance).
Am I missing something here? Why call a method
Is it just there as a default, to return itself, if a to_model doesn't
override it on the model itself
On Sep 2, 6:05 pm, John Merlino stoici...@aol.com wrote:
There's a number of calls in the Rails source to convert_to_model,
which takes an activerecord object instance:
convert_to_model
Does anyone know what the controller code would look like for a route
like this:
resources :reports do
new do
post :preview
end
end
and a helper that looks like this:
preview_new_report_path
thanks for response
--
You received this message because you are subscribed to the Google
actually, let me rephrase this. That route points to the preview
action of a reports controller, but why is it a POST for a new
resource?
On Aug 17, 11:32 am, John Merlino stoici...@aol.com wrote:
Does anyone know what the controller code would look like for a route
like this:
resources
I was seeing these examples in a book:
Person.minimum(:age).where('last_name ?', 'Drake')
Person.minimum(:age).having('min(age) 17').group(:last_name)
The thing is minimum is returning a FixNum. When invoking the relation
methods (e.g. where, having) on a fixnum will raise an exception:
I'm not sure what's the difference between before_validation an
before_validation_on_create. Is it that before_validation gets invoked
before a create and update call, whereas the latter just gets invoked
on create call?
--
You received this message because you are subscribed to the Google
I know that there is an ActiveModel Validator class
https://github.com/rails/rails/blob/master/activemodel/lib/active_model/validator.rb
which is used for the class level validation macros.
But I didn't find a an ActiveRecord Validator class.
From my understanding in Rails 3, validations have
On Aug 1, 10:41 am, Dave Aronson googlegroups2d...@davearonson.com
wrote:
On Wed, Aug 1, 2012 at 12:09 AM, John Merlino stoici...@aol.com wrote:
this will
raise an error, because project_id does not exist yet, since the
project has not been saved yet.
Can you create the project first, saving
...@gmail.com
wrote:
On Tuesday, July 31, 2012 2:09:41 AM UTC+1, John Merlino wrote:
Account.reflect_on_association(:users).active_record
= Account(id: integer, name: string, created_at: datetime,
updated_at: datetime, ancestry: string, street_address: string, city:
string, postal_code
In the Rails documentation, it shows Association::AssociationProxy,
and I know that in ruby :: operator is a reference to a constant, and
a constant can either be a module or a class. So I ask because I'm
just curious how the two behave together. Thanks for response.
--
You received this message
In a popular Rails book:
prompt to check if the association are
valid next), and since the project has not yet been saved, this will
raise an error, because project_id does not exist yet, since the
project has not been saved yet. So why does book say to use
validates_presence_of :project_id?
On Jul 31, 11:57 pm, John
I was horsing around with the reflect_on_assocation class method of
ActiveRecord Reflection, which returns an instance of
AssociationReflection. One of its methods is called active_record. I
run it in console:
Account.reflect_on_association(:users).active_record
= Account(id: integer, name:
You would either use RSpec or Test::Unit. Test unit built into rails
while rspec seems to be the flavor of the day. I use capybara for
cucumber testing, when you want human-readable output as part of your
test suite. factory girl is a replacement to rails fixtures, which are
unreliable.
On Jul
On the other forum on stackoverflow, someone provided this as a
solution for the following use case: I want to check by an unique ID
whether a record is already created. If it is, I want to add 1 to the
amount attribute. If it is not, I want to create it and set the amount
attribute to 1.
Here
:validate = true on a belongs_to tells Rails to validate the owner
record when the owner record is being saved in order to get a foreign
key value for the association. This doesn't seem to make sense,
because you cannot save an association without saving first the owning
record, so let's say:
I noticed the has_many relationship method allows for :group
and :having options. Can anyone provide an example of when these would
be used in a has_many?
Something like this?
has_many :accounts, :select = 'name, SUM(cash) as money', :group
= :name, :having = 'created_at ?, 2.days.ago'
I cant
I am struggling somewhat with testing. And I would like to know a
comprehensive reference on rails unit test. I find the railscasts 5
minute video not comprehensive. I have the ruby programming language,
design patterns in ruby, and rails 3 way books and none of them delve
at all into testing. So
Yeah that's pretty much the key point - that return type of invoking
the / method of integer and passing it a decimal is a decimal type
cast.
On Jul 12, 12:45 pm, Dave Aronson googlegroups2d...@davearonson.com
wrote:
On Thu, Jul 12, 2012 at 1:13 AM, John Merlino stoici...@aol.com wrote
Often times the ceil method is used for patterns that involve grouping. For
example, if I have an array of objects and I want to group them in rows of
3, I might do this:
(@objects.size / 3.0).ceil
So if size returns 2, then the above expression returns 1.
Here's my question. In terms of
Hey all,
I saw this piece of code:
@user = User.find(params[:user_id]) rescue nil
why rescue with a nil here? If the user is not found, it will be nil
anyway.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send
ok I thought it would return nil
thanks for response
On Jun 19, 8:33 pm, Fernando Almeida ferna...@fernandoalmeida.net
wrote:
if the record is not found the find() throws an exception.
2012/6/19 John Merlino stoici...@aol.com
Hey all,
I saw this piece of code:
@user
Hey all,
When I run rake routes, I see this:
inventory_dashboard /inventory/
(.:format)
{:action=show, :controller=inventory}
when I invoke this:
inventory_dashboard_path
I get this:
Processing InventoryController#index (for 127.0.0.1 at 2012-06-07
I have a situation where a code can be toggled on/off so a record is
sent to database with a value of 1 or 2 for code. So lets say it was
toggled 4 times:
id, code, time
1, 1, 2012-05-31 22:05:24
2, 2, 2012-05-31 22:05:25
3, 2, 2012-05-31 22:05:26
4, 2, 2012-05-31 22:05:27
So it was toggled
I'm basically looking for something more elegant than this:
item = []
item last_on = where{:code = 8}.order('time desc').limit(1)
item last_off = where{:code = 9}.order('time desc').limit(1)
On Jun 1, 3:23 pm, John Merlino stoici...@aol.com wrote:
I have a situation where
I read in the Rails 3 Way book that when using select(), you can, in
addition to adding calculated columns (i.g. using sql aggregate
functions), include additional attributes in resulting object by
passing the wild card like this:
Unit.select(:*,sum(unit_type_id) as
On rails 3 and ruby 1.9.2, I get this error:
(eval):1: syntax error, unexpected $undefined
$#MenuBuilder:0x007fd9360719a0 = #MENUBUILDER:0X007FD9360719A0
^
Not sure where to start with this. Everything looks fine to me:
#_main_menu.html.haml
#main-menu
= menu do |m|
= m.submenu Products
yeah i was using rails 2 thanks for response
On Apr 22, 10:53 pm, Frederick Cheung frederick.che...@gmail.com
wrote:
On Apr 23, 6:46 am, John Merlino stoici...@aol.com wrote:
Hey all,
I look at the rails documentation validation helpers:
http://api.rubyonrails.org/classes
I see something like this:
require ostruct
class OptionsWrapper OpenStruct
undef :id, :class
def [](key)
send(key)
end
def []=(key, value)
send(#{key}=, value)
end
def method_missing(method, *args, block)
return @table.include?(method) ? @table.send(method) : nil if
that makes sense, thanks
On Apr 30, 12:41 pm, Tim Shaffer timshaffe...@gmail.com wrote:
id and class are built-in ruby methods that are present on all object
instances.
Rails uses them in a different manner than the default Ruby implementation.
They are undefined so that they can be picked
Hey all,
I look at the rails documentation validation helpers:
http://api.rubyonrails.org/classes/ActiveModel/Validations/HelperMethods.html
It has this example:
class Person ActiveRecord::Base
validates_inclusion_of :states, :in = lambda{ |person|
STATES[person.country] }
end
So basically
This was a simple fix. You dont escape html in rails 3.
On Mar 26, 5:38 pm, John Merlino stoici...@aol.com wrote:
I have a form helper that looks like this:
#_alert.html.haml
= add_field_link Add Email, f, :notification_emails
#application_helper.rb
def add_field_link(name, f
I have a form helper that looks like this:
#_alert.html.haml
= add_field_link Add Email, f, :notification_emails
#application_helper.rb
def add_field_link(name, f, association)
new_object =
f.object.class.reflect_on_association(association).klass.new
fields = f.fields_for(association,
The ruby library comes with a method called merge that allows you to
merge two hashes. So then why does merge_conditions exist in
activereocrd, which appears to be doing the same thing.
thanks for response
--
You received this message because you are subscribed to the Google Groups Ruby
on
I have been unable to figure out how to update a list of model
instances and their associations and I have looked in the
documentation, which doesnt give an example of what I am trying to do:
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for
I would assume
Hey all,
I looked at source code for fields_for:
def fields_for(record_name, record_object = nil, fields_options = {},
block)
fields_options, record_object = record_object, nil if
record_object.is_a?(Hash) record_object.extractable_options?
fields_options[:builder] ||= options[:builder]
Hey all,
I tried following this railscasts:
http://railscasts.com/episodes/196-nested-model-form-part-1
But there is one significant difference from what that does and what I
am trying to do. That builds a relationship to one object. In my form,
i have a list of objects and want to build
There wont be a specific timezone, people will use it in all timezones
and so I would need it to work for everyone.
This issue started for me when I had this:
validates_inclusion_of :date_of_birth, :in =
110.years.ago.to_datetime..60.years.ago.to_datetime, :message
= :invalid_age, :allow_nil
Hey all,
A lot of people use factory girl to simulate behavior without
affecting database, particularly for testing. I have a situation where
this is not for testing but rather someone clicks on button to
simulate behavior but we create a User object in order to run the
simulation but while I
Using this technique:
Report.where(unit_id=? AND id = ? AND id = ?, unit_id, report1,
report2).sum('distance')
was ultimately the best solution for me, because using find_by_sql and
then calling sum on it would behave unexpectedly, like sometimes the
sum would have to be invoked twice:
Hey all,
So I have a custom query that I embedded into a class method
definition:
def self.get_sum_for_range(unit_id,report1,report2)
find_by_sql([SELECT SUM(distance * 0.000621371192) as sum FROM
reports WHERE unit_id=? AND id = ? AND id = ?, unit_id, report1,
report2])
end
value =
thanks for responses, the ultimate goal was just to ensure a list of
500 (no more or less) unique random decimals that are 3 places which
would be generated only one time. Currently Im storing them as a float
in the mysql database.
--
You received this message because you are subscribed to the
I have interesting situation.
a.rb #file
class A
include M
end
b.rb #file
module M
include X
extend Y
end
module X
def instance_method
end
end
module Y
def class_method
end
end
A.class_method = undefined method class_method
Thats strange because what I expect to happen is module M
Hey all, using ruby 1.8.7, I wrote this:
500.times.map { Integer((rand * 1) * 1000) / Float(1000) }
Basically, this gives me a list of 500 random decimal numbers that are
rounded to 3 places. However, I also want to make sure that all are
unique.
thanks for response
--
You received this
How do you have control (in this case deleting a cookie) after devise
has determined that a user has entered the wrong password in the
latest version of devise. I have my own custom failure app but cookies
are not accessible within it:
class CustomFailureApp Devise::FailureApp
def respond
Hey all, I have a form, when it posts, if it fails, it sends a
response back to the client. Now I want to take the response data and
then send it to a wordpress blog for the wordpress to handle it. I
already set up the rails app as a proxy to the wordpress blog when a
certain page is invoked. My
I was always under assumption that the block accepts the return value
of the iterator as the argument to the block, but look at this:
Array.new(500) do | i |
puts i
end
I expect i to be an array instance with 500 indexes all will nil
values. However, what it returns is indeed an array
. It obviously is an integer.
Otherwise this would have failed with (id +1).
On Feb 25, 2:55 pm, Valery Kvon adda...@gmail.com wrote:
On 25.02.2012, at 23:41, John Merlino wrote:
I was always under assumption that the block accepts the return value
of the iterator as the argument to the block, but look
. And then the return value is passed back to the
resutlt of the yield and that value is then idnexed into the array
until the size limit has been reached.
On Feb 25, 3:15 pm, Valery Kvon adda...@gmail.com wrote:
On 26.02.2012, at 0:07, John Merlino wrote:
thanks for response but that was just an example
This is not actually a piece of code I would use, but rather something
from a book thats a mental exercise.
On Feb 4, 7:20 pm, Robert Walker li...@ruby-forum.com wrote:
John Merlino wrote in post #1044105:
The % is modulus (remainder)operatorand ^ is bitwise. In this
context, we take a file
The % is modulus (remainder) operator and ^ is bitwise. In this
context, we take a file, and go through each character and encrypt it.
But why are the ^ and % operators used here:
def encrypt(reader, writer)
key_index = 0
while not reader.eof?
clear_char = reader.getc
Maybe the title of this post sounds crazy but its true.
- iterate_for(@reports)
- @reports.to_enum.with_index(1).each do |r, i|
- r.alerts.reverse.each do |a|
- if a.code == 14
%tr
%td.num_col Trip #{i}
- elsif a.code == 15
After typing second message, I realized the nested loop was causing
the issue.
--
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
Meinlschmidt to...@meinlschmidt.com wrote:
On Jan 22, 2012, at 23:36 , John Merlino wrote:
Hey all,
I am getting this error:
NoMethodError (undefined method `gsub!' for 2012-01-22 17:00:00
-0500..2012-01-23 00:00:00 -0500:Chronic::Span):
in this code:
date_range
using Chronic.parse without false got rid of that issue
On Jan 23, 10:21 am, John Merlino stoici...@aol.com wrote:
thanks for response,
Now I get a new issue:
ActiveRecord::StatementInvalid in HomesController#map
PGError: ERROR: time zone displacement out of range: (2012-01-23
10:00:00
- @reports.to_enum.with_index(1).each do |r, i|
- r.alerts.reverse.each do |a|
- if a.code == 14
%tr
%td.num_col Trip #{i}
%td.start_col #{r.time}
%td.end_col
%td.distance_col #{0}
i should equal 1
thanks for responses
On Jan 21, 4:24 pm, Peter Vandenabeele pe...@vandenabeele.com wrote:
On Sat, Jan 21, 2012 at 9:03 PM, John Merlino stoici...@aol.com wrote:
Object is the root of Ruby's class hierarchy. Its methods are
available to all classes unless explicitly overridden.
Wouldn't
Hey all,
I am getting this error:
NoMethodError (undefined method `gsub!' for 2012-01-22 17:00:00
-0500..2012-01-23 00:00:00 -0500:Chronic::Span):
in this code:
date_range = Chronic.parse(the_date, :guess =
false)
Object is the root of Ruby's class hierarchy. Its methods are
available to all classes unless explicitly overridden.
Wouldn't Class class be at the root of the class hierarchy?
After all, look at this:
1.9.2p290 :006 Object.instance_of? Class
= true
Object is an instance of class, after all
.
Then why:
n = m.new
doesnt new create an object that gives n access to m's class
methods, as it did in the other case?
On Jan 21, 3:03 pm, John Merlino stoici...@aol.com wrote:
Object is the root of Ruby's class hierarchy. Its methods are
available to all classes unless explicitly overridden
Hey all,
When running a cucumber test, I get this:
Internal Server Error
Mysql2::Error: Lock wait timeout exceeded; try restarting transaction:
INSERT INTO `users` (`address_1`, `address_2`, `address_3`,
`can_receive_sms`, `city`, `completed_terms_on`, `country_id`,
`created_at`,
Hey all,
I have 90 records in database with this kind of format: 2011-05-10
11:23:15
So they are all 2011-05-10 but have different times.
User enters two dates, and just in case the two dates are the same, I
want to ensure I grab all records that span entire day.
So I do this:
')).end_of_day)
On Jan 17, 8:26 pm, John Merlino stoici...@aol.com wrote:
Hey all,
I have 90 records in database with this kind of format: 2011-05-10
11:23:15
So they are all 2011-05-10 but have different times.
User enters two dates, and just in case the two dates are the same, I
want
Hey all,
Chronic will parse a date range in console:
Chronic.parse(1/1/2011 - 1/1/2012, :guess = false)
= 2012-01-01 12:00:00 -0500..2012-01-01 12:00:01 -0500
However, when I use logger to check if it's parsing in application, it
is not:
logger.info The value of history date is
(Date.parse(history_date), :guess = false)
else
date_range =
Chronic.parse(history_date, :guess = false)
end
Im open to better solutions.
thanks for response
On Jan 1, 12:54 pm, John Merlino stoici...@aol.com wrote:
Hey all,
Chronic will parse
, Jan 1, 2012 at 9:54 AM, John Merlino stoici...@aol.com wrote:
Chronic will parse a date range in console:
However, when I use logger to check if it's parsing in application, it
is not:
Loading development environment (Rails 3.1.2)
ruby-1.9.2-p290 :001 result = Chronic.parse(1/1/2011 - 1/1
Hey all,
I call this method to create two objects with certain attributes but
because of this, these objects do not have the attributes of any of
the report object instantiated normally:
def self.sum_distance_by_date
find_by_sql(SELECT date_trunc('day', time), SUM(distance) FROM
reports
Hey all,
I have a domain, let's say:
dev.mysite.com
And I want it to listen on port 3000:
dev.mysite.com:3000
Now this is on a remote webserver (not my local apache setup).
I have access to the server (which is apache and it's running on
ubuntu os).
This server is a rails application in it
I read this article:
http://codecolossus.com/2008/04/12/configurating-passenger-mod_rails-on-slicehost-with-ubuntu-710/
And it says that:
Passenger doesn’t even require virtual hosts to configure themselves
as Rails applications. It will automatically detect a Rails
application
So maybe that's
Hey all,
When logging in and out using devise I know to override the
sign_in_and_redirect method that devise provides in my users sessions
controller, however when I want to get json response when resetting
password, I dont know what method to override and where. I do know of
recoverable module
Frederick Cheung wrote in post #1032161:
On Nov 16, 1:46pm, John Merlino stoici...@aol.com wrote:
thanks for response
THis here would produce syntax error:
:include = {:reports, :notifications = :notification_codes}
oops, that should have been [:reports, {:notifications
(:id = params[:user_id]).first.units.to_json({:include =
{:reports = {}, :notifications = :notification_codes}})
But this will say:
can't convert Symbol into Hash
On Nov 16, 3:14 am, Frederick Cheung frederick.che...@gmail.com
wrote:
On Nov 15, 11:06 pm, John Merlino stoici...@aol.com wrote
this error usually occurs when trying to mix 1st and 2nd order
relationships in a single to_json call:
undefined method `macro' for nil:NilClass
Rails 3 has this way to support 2nd order relationships:
http://apidock.com/rails/ActiveRecord/Serialization/to_json
So I try to use it:
On Tue, Nov 15, 2011 at 9:06 PM, John Merlino stoici...@aol.com wrote:
this error usually occurs when trying to mix 1st and 2nd order
relationships in a single to_json call:
undefined method `macro' for nil:NilClass
Rails 3 has this way to support 2nd order relationships:
http
I also asked this on stackoverflow:
http://stackoverflow.com/questions/7997009/rails-3-getting-devise-to-return-json-data-when-signing-out
I am finding it difficult to resolve this issue.
On Nov 2, 7:43 pm, John Merlino stoici...@aol.com wrote:
Hi all,
In curl (the command line program), I
Hi all,
In curl (the command line program), I can successfully log a user in
using devise:
def create
respond_to do |format|
format.json {
if user_signed_in?
return render :json = {:success = true, :errors =
[Already logged in.]}
end
thanks for response, the solution I provided also works if you want to
pass params in hash via query string when there isn't a direct
association between multiple models
On Oct 31, 3:26 pm, Tim Shaffer timshaf...@me.com wrote:
On Sunday, October 30, 2011 9:31:50 PM UTC-4, John Merlino wrote
This was easy resolution:
send_activation_notification(:user_id = @user.id, :account_id =
@account.id)
That will pass the params in query string
--
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
at 00:09, John Merlino stoici...@aol.com wrote:
ruby-1.9.2-p136 :095 portfolio.each {|n, b| n = b }
NoMethodError: undefined method `balance' for nil:NilClass
It appears that the each iterator does not support passing in two
arguments?
Correct. each means apply this block to each
hey all,
I have this:
scope :path = '/activation', :controller = :activation do
post create = :create
get confirmation = :confirmation, :as = confirmation
get send_activation_notification
= :send_activation_notification, :as = send_activation do
thanks for response, code was an integer, and :code was just a key of
the session hash. But I decided in end to make this database backed.
On Oct 23, 3:19 pm, Dave Aronson googlegroups2d...@davearonson.com
wrote:
On Mon, Oct 17, 2011 at 17:27, John Merlino stoici...@aol.com wrote:
THis line
Hi all,
In Rails console (just doing a general exercise in ruby design
patterns), I create two classes:
ruby-1.9.2-p136 :023 class A
ruby-1.9.2-p136 :024? attr_accessor :name, :balance
ruby-1.9.2-p136 :025? def initialize(name, balance)
ruby-1.9.2-p136 :026? @name = name
ruby-1.9.2-p136
] code if key
So if you see a problem here, maybe I am not understanding.
thanks for response
On Oct 18, 6:26 am, Frederick Cheung frederick.che...@gmail.com
wrote:
On Oct 17, 10:27 pm, John Merlino stoici...@aol.com wrote:
Hey all,
THis line of code gets called multiple times and creates
Hey all,
THis line of code gets called multiple times and creates a hash:
def session_code(unit_id, code)
s_code = session[:code]
unit_id_hash = s_code.detect {|h| h[unit_id]}
if unit_id_hash.nil?
unit_id_hash = {}
s_code {unit_id = unit_id_hash}
end
key =
101 - 200 of 394 matches
Mail list logo