Displaying 20 results from an estimated 8000 matches similar to: "link_to meta programming question"
2012 Apr 14
7
undefined method `model_name' for NilClass:Class
Hi guys,
I just started using Ruby on Rails. After implementing the RoR blog
tutorial I started with my own data model.
Sadly I am not able to get my create page running.
Model:
class Activity < ActiveRecord::Base
validates :activity, :presence => true
validates :forKids, :presence => true
validates :start_date, :presence => true
end
Controller:
class ActivitiesController <
2010 Feb 25
9
uninitialized constant UsersController::User
i just created an application to list the primary details of
userbut it is showing an error lik this
"uninitialized constant UsersController::User"
this is my controlller
class UsersController < ApplicationController
puts"hiiiiiiiii"
def index
puts"hiiiiiiiii"
@users = User.find(:all)
puts @users
respond_to do |format|
format.html # index.html.erb
2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
Hi All,
just in a spot of bother with this gem, I am trying to create a new
location and get the above msg.
here is my controller:
class LocationsController < ApplicationController
# GET /locations
# GET /locations.json
def index
@locations = Location.all
@json = Location.all.to_gmaps4rails
end
respond_to do |format|
format.html # index.html.erb
2009 Mar 14
2
Pobrem with REST routes
Hi first at all sorry if mu english is not the best.
I have this models:
Encuesta->titulo and description are string. Encuesta has_many
:preguntas
Preguntas-> texto is string, encuesta_id and orden are integer. Pregunta
belongs_to :encuesta and has_many :soluciones
Soluciones-> texto is string, pregunta_id and orden are integer.
Soluciones belongs_to :pregunta
Routes:
map.resources
2010 Sep 04
3
its easy but i forgot all
my models
borrower ----- has_many :loans
loan ----- belongs_to :borrower
my loans _controller
def new
@borrower = Borrower.find(params[:borrower_id])
logger.debug '' @borrower.id''
logger.debug @borrower.id
@loan = Loan.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @loan }
end
2011 Sep 06
8
Ajax and rails 3 UJS (jquery)
Hi, guys,
I''m in the midst of moving an app from rails 2.3.8 to rails 3.0.9.
Sadly, rails 3 no longer has javascript generators and I''m now forced
to do more javascript.
For my project, I have selected jQuery as the javascript framework for
my rails 3.0.9 app.
What I have done to have my app''s deletion link (for each item)
trigger an alert box when the deletion
2007 Dec 22
8
Rails 2.0 rescue_from
I am trying to use the new Rails 2.0 macro : rescue_from
class PostsController < ApplicationController
rescue_from ActiveRecord::RecordNotFound, :with => :deny_access
...
def show
@post = Post.find_by_id(params[:id])
raise ActiveRecord::RecordNotFound if @post.nil? #illegal access
.....
end
def deny_access
respond_to do |format|
format.html
end
end
but the
2012 Jan 04
1
render :update problem with IE 9
Hi,
I have a legacy web site based on ruby on rails 3.0.9 which works just fine
with Firefox, chrome and IE 8, but I receive an HTTP 406 error every time
when I check the web site with Internet Explorer 9. I narrowed down the
problem to the respond_to + format.js + render :update trio, but I did not
manage to solve the problem until now.
I created a small example for reproduction:
The action
2007 Mar 23
11
Is there such a thing as button_to_remote?
I''ve changed my destructive link_to statements in favor of button_to.
But what if I want to make an .rjs call with that button?
Seems like we need something equivalent to link_to_remote, so that the
button can make an ajax request instead submitting the form.
Or am I missing the point entirely?
Jeff
--~--~---------~--~----~------------~-------~--~----~
You received this message
2007 Sep 20
11
Proposed API change for respond_to
Ez (or someone) asked on #merb tonight whether respond_to was the
right API for
what it does. After some discussion and pasties, I offer the
following proposed
API for content negotiation and response format selection:
First, what does respond_to do right now? I see at as performing 3
distinct
operations:
1. parse params[:format] and the accepts header to find out what
format the
2008 Apr 13
20
uninitialized constant
Hi guys, I''m part way through a RoR application, for some reason
whenever I add new controllers (using scaffold) I get an uninitialized
constant [name of controller] error.
The first few controllers work fine, the only thing I can see that I''ve
changed is the layout file (but scaffold creates a new layout for each
controller so can''t see that being the problem). You
2008 Mar 31
10
Problems with *_path() and *_url() helpers when using Publisher
Hello,
I am running into issues using *_path() and *_url() helpers the
Facebooker Publisher framework. I encounter the following error when
using these helpers while *inside of a partial*:
undefined method `default_url_options'' for ActionView::Base:Class
I''ve seen a few other people speak about this issue, yet I haven''t
seen any resolution on the mailing list yet.
2008 Feb 29
3
How to DRY REST admin path in URLs?
Hi everyone...
For almost all of my objects I put a series of classic REST admin links
in views. For example, for a ''user'', I have
<%= link_to "Show", user_path(user) %>
<%= link_to "Edit", edit_user_path(user) %>
<%= link_to "Destroy", user_path(user), :confirm => "Are you sure",
:method => :delete %>
I am tired
2007 Aug 30
1
alias_method_chain stack level too deep in Rake test only
I have an odd error. I have the following module:
module ActionController
module SslSupport
def self.included(base)
raise "#{base} does not define url_for" unless
base.method_defined?(:url_for)
unless base.respond_to?(:url_for_without_ssl_supprt)
base.send :include, InstanceMethods
base.send :alias_method_chain, :url_for, :ssl_support
end
2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
Hi all,
I am getting ActiveRecord to produce XML with
render :xml => @user.to_xml
However, on the client end it is a bit annoying for me to deal with
attributes like first-name. I would much rather have first_name.
Is there any way for me to turn off the behavior of converting _ to -?
This seems to be done by a call to dasherize inside the to_xml of
2011 Jul 27
20
Rails, jquery and Ajax
How do I make an ajax call and then update a div with a partial? I''ve
tried this but it''s not working. Comment is created but the partial is
not loaded.
//view
<a href="#" id="testlink">Testlink</a>
<div id="commentlist">
</div>
//controller
def new
@comment = Comment.new
@comment.save
2006 Apr 11
7
Undefined Method
Where can I define the method ''tbluser'' in this error?
NoMethodError in Tblregisteredphone#list
Showing app/views/tblregisteredphone/list.rhtml where line #23 raised:
undefined method `tbluser'' for #<Tblregisteredphone:0x375c778>
Extracted source (around line #23):
20: </font>
21: </td>
22: <td>
23: <%= link_to
2008 Feb 29
4
App design question: user_photo helper
I''m having trouble using an application helper and understanding how I
should make it work throughout my application - so if you can help me
with this I''ll be overcoming a big hurdle in my learning.
Here''s the helper method;
[code=]# application_helper.rb
def user_photo
if @user.photo?
return @user.photo.public_filename(:thumb)
else
return
2008 Dec 11
1
help needed regaring Acts As Taggable On Steroids
Hello,
In my rails application, I have a book model.
I want to add tags. For that I have installed
acts_as_taggable_on_steroids from this link
http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids
and do as the readme file.
This is my Model :
class Book < ActiveRecord::Base
acts_as_taggable
end
Here is my ApplicationHelper :
module
2013 Oct 02
2
Rails 4 ujs button only works after second click
Here''s the code
https://gist.github.com/dasibre/6786245
*new.js.erb file has the following js code*
$(''a.pinbutton'').on(''click'', function() {
$(this).parent().append(''<%= escape_javascript(render("select")) %>'')
});
*here''s the player index with the new link*
<%= link_to "Pin",