Displaying 20 results from an estimated 900 matches similar to: "dynamic route generation"
2012 Sep 03
0
undefined method `singular_route_key' for "User":ActiveModel::Name
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
object, which is a wrapper to the string class, that returns a string
name of the class of an
2012 Sep 08
4
dash symbol
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: Talk" group.
To post to this group, send email to
2012 Jan 01
4
Chronic parsing date range in console but not in application in rails 3
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 #{history_date}" =>
The value of history date is 1/1/2011 - 1/1/2012
2006 Aug 03
1
routeset mapper problem
hello,
I installed a rails app on dreamhost, which I''m building based on the
Comatose plugin, and it went smoothly for the first version.
Now I uploaded a second version where I broke down the Comatose code
into a regular rails app, which works alright locally, but can''t get
routing to work the same as before on the server. I believe I
double-checked all gotchas mentioned
2013 Apr 03
2
strange behavior with active relation any? method
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 correctly evaluates to true because the relation contains one
2008 Dec 20
3
undefined method `stories_path'
Hi,
I recieve error "undefined method `stories_path'' for
#<ActionView::Base:0x995b4ac>" when going to the view via
site.com/stories/new
The model is setup correctly, I can retrieve data from the db fine. I
think it might be related to the helper but I have no idea where to
start. It seems to think its failing on the first line of the view, i
belive on the
2007 Jan 24
0
problems with themes in rails 1.2.1 -> named_route
i saw someone mentioned this somewhere else (1), but i wanted to make
sure that this wasn''t something that was going to cause me alot of grief
later..
i have been using the theme plugin (2) on several projects..
i updated to 1.2.1 today, and upgraded my mongrel to the latest one..
when i try running mongrel after updating my project, i get the
following error:
2010 Nov 01
2
Creating RESTful helpers on the fly
If I have a resource called ''assets'' then I get for free a bunch of
helpers, like
assets_path
new_asset_path
and so forth, right?
I would like to be able to create a call to one of these on the fly when
I only find out the name of the resource at run time. For example I
would like to do this:
resource_name = "assets"
resource_path(resource_name, method => :new)
2010 Dec 15
2
Error reverse engineering MySQL with RMRE
Hi
I am been trying in vain to auto-gen models by reverse-engineering
mysql using RMRE. It complains mysql2 gem missing but as seen in my
Rails environment below, it is there.
Here''s my Rails environment and RMRE error. Experts... please help!
Thanks a ton in advance!!
===
Ruby version 1.9.2 (x86_64-linux)
RubyGems version 1.3.7
Rack version 1.2
Rails version 3.0.3
Active Record
2012 Jan 21
4
why doesn't an instance of Object get Class's new instance method?
"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 we can use one of Class''
instance methods on Object:
2009 Jul 13
3
undefined method error from atom builder
I have a simple controller that takes a request, looks up some data
and then returns the results as either HTML or Atom. The HTML response
works fine, but the Atom Builder is blowing up with an undefined
method error that I can''t figure out. It seems to be failing when the
ActiveRecord instance is passed to the ''entry'' method and it tries to
build the URL via the
2013 May 07
2
Net::HTTP
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
response = http.request request # Net::HTTPResponse object
end
uri =
2012 Feb 04
3
the ^ and % operators in context
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
encrypted_char = clear_char ^ @key[key_index]
writer.putc(encrypted_char)
key_index = (key_index +
2013 Apr 27
3
where exactly are gems?
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 bundler looks for gems?
--
You received this message because
2012 Sep 22
4
Class, Module, 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 instance
2007 Mar 06
4
Rails 1.2 / Theme support plugin issue: Fix
This is to answer one of my old issues, that I was having using Theme
support plugin using with Rails 1.2.
When you get an latest edge Rails update and run your application which
has Theme support plugin you will get following error
/script/../config/../vendor/plugins/theme_support/lib/patches/routeset_ex.rb:26:in
`create_theme_routes'': undefined method `named_route'' for
2013 May 18
3
You have already activated rake 10.0.4, but your Gemfile requires rake 10.0.3.
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 works fine. but then when I use rake to create the
database "rake db:create". I get
2011 Feb 09
16
rails 3.0.4 broke yield :javascript ?
hello,
I have today updated my rails app to 3.0.4 security release but now this
yield :javascripts
fails in the layout and I get my custom js escaped as text in the view.
anybody seeing this also?
tia,
jk
--
www.least-significant-bit.com
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to
2013 Mar 26
2
Using rack.hijack with ActionController::Live
Pinging @tenderlove
Some questions on how best to move forward with this:
1.) AC::Live is making use of the stream object on
ActionDispatch::Response. Should the rack.hijack_io object be used instead
of this in AC::Live or should ActionDispatch::Response be changed to use
rack.hijack_io?
2.) What do you think about changing AC::Live to work with adapters? I
suspect the primary use case for
2010 Nov 19
1
Help: delegated association 'App' returning ActionDispatch::Integration::Session instead
class Foo < ActiveRecord::Base
has_one :bar
delegate :app, :to => :bar
end
class Bar < ActiveRecord::Base
belongs_to :app
def self.attribute_column_names
return @@attr_columns if defined?(@@attr_columns)
readers = content_columns.map { |n| n.name.intern } -
[:created_at,:updated_at]
@@attr_columns ||= readers.map { |k| [k, "#{k}=".to_sym] }.flatten
end