Displaying 20 results from an estimated 4000 matches similar to: "problem when editing record in polymorphic relation"
2008 Jan 08
0
Error in validation
I have the following model
===========================
class SoftwareCi < ActiveRecord::Base
has_one :ci, :as => :content
has_one :primary_group
validates_presence_of :name, :message => "can''t be empty"
end
The controller
================
def create
@software_ci= SoftwareCi.new(params[:ci])
redirect_to :action => ''create_ui''
end
The
2007 Aug 09
7
Integrating polymorphic models into controllers views? how?
I''m having trouble trying to get this to work.
How the heck do you get a polymorphic controller to work? Especially
integrating it with a view?
Let''s say that we have shows, and episodes, then comments.
A show has many episodes, an episode has many comments.
the route is /shows/1/episodes/1/
Now to add a comment to that episode, how would I do it? Let''s say
that the
2007 Sep 23
9
Code reviews: my dumb use of acts_as_commentable (newbie)
With the help of several heroes here yesterday I beat my way into a
working solution to adding comments to one or more models in my
application using acts_as_comentable. Great plugin, but my
implementation is lame. I need enlightenment.
I have users who log in. For several views I want to let them add
comments. Enter act_as_commentable which does just this -- it''s
polymorphic, so you
2006 Aug 02
7
form_for not working with Markaby
I''m playing around with Markaby and I decided to write a little blog app.
I''m running into issues with forms however. If I use form_for the output of
the form gets swallowed. For example:
form_for :article, @article do |f|
f.text_field :title
f.check_box :published
f.text_area :description
f.text_field :pub_date
f.text_area :content
end
gets rendered as an empty form
2007 Sep 25
21
form_for and partials
I love form_for, but I really hate
<% form_for :person, @person, :url => {...} do |f| %>
...
<%= render :partial => ''form'', :locals => {''f'' => f}
...
<% end %>
I''ve been thinking of instead allowing
<% form_for :person, @person, :url => {...} do |f| %>
...
<%= f.partial ''form''
2009 Aug 04
6
form_for
hi everybody...
I have a form_for in that, onclicking submit button i am calling
a javascript for validation.If validation fails that form_for doesnt do
anything.But even the validation fails it goes to the controller and
action.
here my code:
<%form_for :promotion_code,
2007 Feb 27
2
Dynamically add radio buttons to forms?
Good afternoon all
I''m trying to implement a form that dynamically inserts radio buttons
into a form. The user selects options from a drop-down menu. I use
observe_field to watch for a change and call back to render the
appropriate partial tha contains the radio options. All works nicely
but I''m tripped up on one thing:
When rendering a form using form_for how do I link those
2007 Sep 18
2
Setting default value in text_field/password_field
I am trying to set a default value in a text_field form. I know how
to do this in html, but is there a way to do
this with form_for
Here is my code
<% form_for :user do |f| -%>
<p><label for="firstname"%>First Name</label><br/>
<%= f.text_field :firstname%></p>
...
<p><label for ="email"%>Email</label><br/>
2011 Jan 05
16
Nicedit (rich text editor)
Hello, I''m trying to use Nicedit to improve my text_areas in some views
of my project.
I have installed jquery:
ruby script/plugin install git://github.com/aaronchi/jrails.git
nicEdit plugin:
ruby script/plugin install
git://github.com/sergio-fry/Simple-nicEdit.git
Add js in layout:
<%= javascript_include_tag ''nicEdit'', ''nicEditInit'' %>
Use it
2006 Oct 13
2
form_for() and name
how can i give name attributes for form_for(), so it will give an output
like <form name="f">. it is because that i need to access the form name
for javascript manipulation.
as far as i know, name can only used in form_tag(), but i currently have
more than 50 forms that built using form_for(). the structure is like
this:
<% form_for symbol, item,
:url => { :action
2006 Aug 05
1
form_for and partials
I''m getting an error in the partial when i try
<% form_for :name do |form| %>
<%= render_partial "#{@current_stage}" %>
<% end %>
So I assume that form_for does not have scope in the partial?
If that is the case what are my solutions...
Do I have to stick a <% form_for in every partial, or do i just change all
my inputs back to text_field
2006 Jul 14
9
DRY Javascript Degredation
Hi,
It seems there must be a better way to do this than what I am
currently doing.
I have a simple app that collects a users thoughts along with their
email address and their first an last name. On a page that lists all
the users thoughts they can click on a link to "add a thought" which
then displays a form with ajax. My current methodology for this is
not very dry. If js is
2009 Jan 18
2
InvalidAuthenticityToken error with remote_form_for
Hi All -
I have a form_for that I''m trying to convert to remote_form_for, and I
keep get this error:
ActionController::InvalidAuthenticityToken
(ActionController::InvalidAuthenticityToken):
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/request_forgery_protection.rb:86:in
`verify_authenticity_token''
2010 Apr 20
5
Smart localisation
Hi,
I have some trouble using Il8n. I''ve had these problems for a while
now and always used rough workarounds, but as my productivity needs to
go up another notch, I was wondering whether there was any way of
avoiding these workarounds.
For example: When I''m inside a view (say ''home/index'') and use
t(''title''), I''d like Rails to know
2011 Aug 31
9
undefined method `model_name' for NilClass:Class in rails 3.0.0
Hi,
i got search which shows following error
ActionView::Template::Error (undefined method `model_name'' for
NilClass:Class):
1: <%= form_for(@employee) do |e| %>
2: EMP ID<%= e.text_field :id %><br>
3: <%= e.submit ''search'', :controller => ''employees'', :action =>
''search1'' %>
2006 Aug 11
2
Accessing belongs_to objects from a form_for context
In a form_for context, is there a way to access objects that are related
to the primary object with a belongs_to? I think an example will serve
best:
class User < ActiveRecord::Base
belongs_to :person
attr_accessor :username
end
class Person < ActiveRecord::Base
has_one :user
attr_accessor :first_name
end
<% form_for :user do |form| %>
<%= form.text_field
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 <
2008 Jul 14
5
How can i use link_to_remote with in form_for
Hi
anybody plz help me how can i use link_to_remote with in form_for.. i
tried but no luck... if i use form_tag i can able to use link_to_remote
and made ajax call.but i need to use form_for ....can anyone help me how
can i do with this.Thanks in advance.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2008 Sep 18
2
Setting up Fleximage
Hello!
I''ve been trying today to setup fleximage to handle photo uploads to a
RoR application by following the tutorial that is provided
(http://github.com/Squeegy/fleximage/wikis/gettingstarted)
Originally, I just dropped in all of the sample code that they provided,
which I copied below this question.
- When I tried to access "new" to upload a new photo, I received an
error
2010 Oct 14
7
undefined method?
I''m trying to learn rails as I go along, and having a bit of trouble.
There is an undefined method cropping that I don''t know why rails
thinks should be there.
Firstly, I''m using rails 3, ruby 1.9.2
I have a controller with an index action This part works fine, but i
am trying to add a comment form to the page that is rendered by that
index action.
Supposing my