Login
1 error prohibited this {{model}} from being saved
There were problems with the following fields:
{{attribute}} {{message}}
this is the view code
<h1>Login</h1>
<% form_for #user_session, :url => user_session_path do |f| %>
<%= f.error_messages %>
<%= f.label :login %><br />
<%= f.text_field :login %><br />
<br />
<%= f.label :password %><br />
<%= f.password_field :password %><br />
<br />
<%= f.check_box :remember_me %><%= f.label :remember_me %><br />
<br />
<%= f.submit "Login" %>
<% end %>
`
its odd and it shows up on in the time_ago_in_words method when the out put is in months
just kinda started doing this randomly, anybody seen this before?
Yes, it happens when the version of Ruby has been upgraded to a version that is not supported by your version of Rails. Older version of rails uses a syntax that is not supported by newer versions of Ruby.
To solve it, you should either upgrade Rails or downgrade Ruby.
Rails 2.3.9 should be sufficient.
http://weblog.rubyonrails.org/2010/9/4/ruby-on-rails-2-3-9-released
the i18n gem needs to correspond to the version of RUBY and RAILS that you're running ...
changelog for i18n.
http://blog.plataformatec.com.br/2010/02/rails-3-i18n-changes/
running
gem uninstall i18n
then
gem install i18n -v 0.4.0
should solve any issues you've got with rails 2.3.8 and the double curly bracket error messages
You can also run into this if you install the i18n gem. I had installed metrical, and one of its dependencies is the i18n gem. This caused the same error as above. Once I removed the gem, I started seeing the correct messages again.
cd <yourRailsProject>
gem install i18n -v 0.4.0 -i vendor/ -V
to install the i18n gem into the vendor folder (-V for verbose output, just to see what's going on under the hood)
Related
I realize that this has been asked on here before, but I don't seem to have the same issue as the previous person as the solutions provided had no effect.
My error is a little different as well.
undefined method `bootstrap_form_for' for #<#<Class:0x007fd2b0c2dbe0>:0x007fd2b0c2c948>
The code that references the method:
<%= bootstrap_form_for(#blob) do |f| %>
<%= f.text_field :contentType %>
<%= f.text_field :data %>
<%= f.text_field :form_id %>
<%= f.submit "Create BLOB" %>
<% end %>
The method comes from this gem.
The gem is in the Gemfile, I have restarted the rails server a few times, and I've tried this with multiple models.
It seems like bundle install was automatically fetching version 3.0.0 of the Gem, but the GitHub lists 2.3.0 as the most recent version available.
Switching to 2.3.0 in my Gemfile fixed the issue.
I am trying to use the gem on a nested form
https://github.com/bcardarella/client_side_validations
My code is
<%= form_for Question.new, remote: true, validate: true do |f| %>
<%= f.text_area :text, cols: 30, rows: 8 %>
<%= fields_for UnrosteredWork.new, :validate => true do |work_fields| %>
<%= work_fields.text_field :minutes"%>
<% end %>
<%= f.submit "Reply" %>
<% end %>
The gem works fine with my :text field.
I am trying to get the gem to work with the :minutes field
Right now, no client side validation is performed.
If break this field out into a separate form
<%= form_for UnrosteredWork.new, :validate => true do |work_fields| %>
<%= work_fields.text_field :minutes%>
<% end %>
Client side validation works fine on the :minutes field.
NOTE I was using version 3.2 of the gem. I am running rails 3.2 app.
I did try upgrade the gem to
gem 'client_side_validations', github: "bcardarella/client_side_validations", :branch => "4-0-beta"
However that didn't help.
Anyone had any success with nested forms before?
I am using carmen-rails 1.0.0.beta 3 and for this I have used the following code:
<%= form_for(contact, remote: true, html: {class: 'popup-form'}) do |f| %>
<%= f.label :country, t('country') %>
<%= f.country_select :country, include_blank: "Select" %>
<% end %>
This gives a result like this:
Aland Island,
Antartica,
Afghanisthan,
..........
But I want Afghanisthan to start the list in case of alphabetical order.
Can anyone give a solution to this sorting problem. It would be helpful.
Thanks.
They've fixed this sorting bug, but perhaps they've not repackaged the gem or something. Try specifying the Git URL in your gemfile and I think it will work for you.
gem 'carmen-rails', git: 'https://github.com/jim/carmen-rails.git'
I have been struggling with this one for days and can't seem to figure out what's wrong. I'm attempting to allow polymorphic file attachments to a model Item, which belongs to model Location. My routes are defined as:
resources :locations do
resources :items
post :sort
end
resources :items do
resources :assets #model for attachments
end
I followed a tutorial about doing exactly this with carrierwave and nested_form. After setting everything up, however, I get the following error when requesting the New action for the Item model: wrong number of arguments (4 for 3). It tells me the error is occurring at line 7 of this view:
<%= nested_form_for [#location, #item], :html => { :multipart => true } do |f| %>
<p>
<%= f.label :name %><br />
<%= f.text_field :name %>
</p>
<%= f.fields_for :assets do |a_form| %> ### LINE 7 ####
<p>
<%= a_form.label :file %><br />
<%= a_form.file_field :file %>
<%= a_form.hidden_field :file_cache %>
</p>
<%= a_form.link_to_remove "Remove this attachment" %>
<% end %>
<%= f.link_to_add "Add attachment", :assets %>
<p><%= f.submit %></p>
<% end %>
If I don't use the nested_form gem and start out the view with a normal form_for, I get no errors and am able to successfully attach a single file to the Item. I can try and proceed without the gem, but (as far as I understand) nested_form will automate some of the functionality like removing the files and generating ajax to add new attachments.
I was just wondering if anyone has run into this error or knows what mistake I'm making that's causing problems with nested_form? I understand what the error means, just not sure where/why the extra argument is being thrown in. I greatly appreciate any insight you can provide!
FYI my dev setup: rails (3.1.0, 3.0.10), nested_form (0.1.1), carrierwave (0.5.7)
In order to get nested_form working with rails 3.1, I had to pull the latest from github rather than using what's in the gem. In my Gemfile:
gem "nested_form", :git => "git://github.com/ryanb/nested_form.git"
I'm trying to write a rails application where users can upload images, but Paperclip doesn't seem to be working for me.
I've gone through all the basic steps (added has_attached_file, the migration, making the form multipart) but I keep getting the same error whenever I try uploading an image:
can't convert nil into Integer
Looking at the top of the stack
...rails3/lib/paperclip/processor.rb:46:in `sprintf'
...rails3/lib/paperclip/processor.rb:46:in `make_tmpname'
.../ruby-1.9.2-head/lib/ruby/1.9.1/tmpdir.rb:154:in `create'
.../ruby-1.9.2-head/lib/ruby/1.9.1/tempfile.rb:134:in `initialize'
It seems the problem is in the tempfile.
My code:
_form.rb
<%= form_for #high_school, :html => {:multipart => true} do |f| %>
<%= f.error_messages %>
...
<div class="field">
<%= f.file_field :photo %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
model/high_school.rb
...
validates_length_of :password, :minimum => 4, :allow_blank => true
has_attached_file :photo
has_many :students
...
Is this a known problem? I basically followed the instructions from the github to the letter.
My environment: Rails3 and Ruby 1.9.2dev
Thank you!
I don't believe paperclip supports ruby 1.9 yet.
Try dropping down to ruby 1.8.7 and see if the problem still exists.
you have to apply this patch http://github.com/dwalters/paperclip/commit/2a85add5f102db8773518f8ac30f7e2337bf7d13 to get paperclip working on 1.9.2 head for the can't convert nil into Integer error
This has now been fixed in version 2.3.3 of paperclip. See this commit:
https://github.com/thoughtbot/paperclip/commit/1bcfc14388d0651c5fc70ab9ca3511144c698903
Here somebody has similar problem to yours with Paperclip on ruby 1.9 (but there is no solution). So probably it is problem with ruby version.