Extra whitespace when rendering a text_area in Rails 3.2.3 - ruby-on-rails

I'm getting an extra white space inside the text area when rendering this HAML code.
= f.text_area :message, placeholder: "Reply"
I'm running Rails 3.2.3 and haml-rails 0.3.4 and haml 3.1.4
I have no idea why this is happening.
This is the code rendered with the extra whitespace
<textarea class="textarea" cols="50" id="idea_idea" name="idea[idea]" rows="2">
</textarea>

Just found a solution to this problem.
I upgraded to the "3.1.5" beta version of HAML and works fine now.
gem 'haml', :git => "git://github.com/haml/haml.git", :branch => "315"

The version you are running should have similar issues fixed, see the ActionPack Changelog linked below, it appears to contain multiple entries related to the issue.
https://github.com/rails/rails/blob/3-2-stable/actionpack/CHANGELOG.md

Related

gem rich don't apperas in Active_admin

I installed gem rich in my Rails 4.1.5 project. I'm using Active Admin. In my file of admin I have this line that calls rich:
f.input :content, :as => :rich, :config => { :height => '200px' }, :label => 'Conteúdo'
But when I open Active_admin, the rich don't appears (should appear right below the first field):
My gemfile:
gem 'rich', :git => 'https://github.com/kreativgebiet/rich.git'
In my application.rb I have this lines:
config.assets.prefix = '/lince/assets'
config.relative_url_root = '/lince'
config.action_controller.relative_url_root = '/lince'
When I try without this lines, rich works fine.
Anyone can help me? I can't understand why this not working.
Thanks.
rich has not been updated in years. I recommend you look at other WYSIWYG editors

Using Spree and Spree Fancy how can I customize the color scheme?

I am new to programming and this is my first Spree app. I am unable to change the color scheme of my app using Spree and Spree Fancy. I've tried following a few tutorials and docs that I've listed below but I am having difficulty implementing Deface and override. I was able to update a page using Deface app/overrides/update_footer.rb file with the following:
Deface::Override.new(:virtual_path => 'spree/shared/_footer',
:name => 'change address to boston',
:replace => "div.address",
:text => "
<div class='address'>
New Location USA
</div>
")
And my Gem file is
gem 'rails', '4.0.3'
gem 'spree', github: 'spree/spree', branch: '2-2-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-2-stable'
gem 'spree_fancy', github: 'spree/spree_fancy'
Links I've tried
http://railscasts.com/episodes/298-getting-started-with-spree?view=asciicast
http://guides.spreecommerce.com/developer/deface_overrides_tutorial.html as well as the guides on assets and views.
What is the correct way to customize the colors? I hope to be able to make other changes of course once I understand the process.
Your deface override is not working because you're trying to replace content which doesn't exist in the template you're overriding.
Take a look at the source for the template here:
https://github.com/spree/spree/blob/v2.2.0/frontend/app/views/spree/shared/_footer.html.erb
I'll paste it below, as it's small.
<footer id="footer" class="sixteen columns" data-hook>
<div id="footer-left" class="columns alpha eight" data-hook>
<p><%= Spree.t :powered_by %> <%= link_to 'Spree', 'http://spreecommerce.com/' %></p>
</div>
<div id="footer-right" class="columns omega eight" data-hook></div>
</footer>
In your deface override, you should see it apply if you change it to override something that is in that template. For example,
:replace => "#footer-left"
If you're just looking to change some of the colours around you should override this file:
https://github.com/spree/spree_fancy/blob/master/app/assets/stylesheets/spree/fancy/variables_override.css.scss
You can then redefine some of the variables listed here:
https://github.com/spree/spree_fancy/blob/a78d4b9017985405b497af9d8d4bc26949d19283/app/assets/stylesheets/spree/fancy/variables.css.scss#L4-L17
You can also style elements by applying new CSS to them, or override the existing styles with higher priority CSS selectors.

How to resolve JSON syntax errors in rails?

I started learning rails using 'Agile Web Development with Rails, 4th Edition'
with
rails 3.2.7 and ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux].
When i tried to
edit an html form with
<%= f.text_area :description :rows=>6 %>
it returned an error
/media/ashku/New Volume/RoR/depot/app/views/products/_form.html.erb:19: syntax error, unexpected ':', expecting ')'
...= ( f.text_area :description :rows=>6 );#output_buffer.safe...
then i tried to change the :rows=>6 to rows: 6 but the results where the same
Discussion here suggests it as problem with JSON
controller code is given here
so how to resolve this problem ?
You have missed the comma(,) after tag name ie.(:description).
So replace your tag with following and try to run..
<%= f.text_area :description, :rows => 6 %>
You're missing a comma in between :description, and :rows.
You can use "Better Errors" gem for debugging in development env., this is a better tool to find errors in good way. read about them from http://railscasts.com/episodes/402-better-errors-railspanel?view=asciicast

Having problems while generating barcode in rails using BARBY gem

I am using:
ruby 1.8.7, rails 2.3.5
ruby gems 1.3.6
Windows 7 Home Basic 64-bit
barby 0.5.0
I'm having problems to generate barcodes for my app. I installed barby 0.5.0 and I was hoping that it would solve my problems. But everytime it generates a file, it seems that it's broken or damaged. It can't be opened. I wonder what I'm doing wrong here.
As for the stack trace, there's really no error.
Here's my code:
barcodevalue = "00000000000"
full_path = "barcode#{barcode_value}.png"
barcode = Barby::Code39.new(barcode_value)
File.open(full_path, 'w') { |f| f.write barcode.to_png(:margin => 3, :xdim => 2, :height => 55) }
render :text => "#{barcode_value}.png has been generated."
Please see this link for answer.
https://groups.google.com/forum/#!topic/ruby-barby/8Vgh-CLNfuI

Rails doesn't expand the variable "count" when displays

I am developing a Rails 2.3.8 app and I stumbled upon a strange form error:
in all errors messages in any input forms, the variable count is not expanded.
As instance if I fill in the following form with a too long string (> 300 chars, I've set max=300), the form will display the message:
"is too long (maximum is {{count}} characters)" instead of:
"is too long (maximum is 300 characters)"
- form_for(#event) do |f|
= f.label :description
%br
= f.text_area :description
= f.error_message_on :description
Do you have any ideas why this happens ?
many thanks
Redmine had this issue and they fixed it in 1.0.5.
See here for the changes:
http://www.redmine.org/news/49
in the message they say something along these lines:
Among 11 bug fixes, Redmine 1.0.5
solves the incompatibility with the
i18n 0.5.0 gem. The appropriate i18n
gem version (0.4.2) is now required
so i assume you need to install the 0.4.2 i18n gem :)
I was having the same issue, and installing i18n 0.4.2 solved it for me.

Resources