After implementing that authorization solution, many of my controllers specs started failing because they are not authorized to run without the proper permission. How can I fake permission in a controller test to fix this problem?
After implementing that authorization solution, many of my controllers specs started failing because they are not authorized to run without the proper permission. How can I fake permission in a controller test to fix this problem?
Great screencast as always! I run into a problem though. Can't make it work to add fields. After click on "add" the browser jumps to the top and no field is added. Remove field is working.
I had the same issue however raising the timeout delay did not work for me. What I found though was the initial PJAX request was rendering the application layout, so I found this fix. In other words I added this:
ruby
defindex# your code here
render layout:falseif request.headers['X-PJAX']
end
I haven't figured out why the initial PJAX request was rendering my application layout, which is weird especially given that when I make PJAX requests to all my other pages the same behaviour does not occur.
For anyone trying to implement this in Rails 4 don't forget to add {:category_ids => []} to params in the products_controller
ruby
defproduct_params
params.require(:product).permit(
:name,
{:category_ids => []}
)
end
And in that case you don't need a hidden field <%= hidden_field_tag "#{f.object_name}[category_ids][]", nil %>
nor params[:product][:category_ids] ||= []
We created a gem at Continuum that provides a DSL on top of Roo for defining data importers. It's called active_importer and we think it could be useful for everyone. It's still a young project, and contributions are very much welcome.
I feel very frustrated after 2 weeks posting question at stack overflow, contacting people from this comment section and trying to figure out by myself how to resize images on the client side using Ryan Bate's method, unfortunately I couldn't solve, my project is 2 weeks late, and I'm very disappointed for not having the best solution explained here... Tha'ts my feedback from this screencast.
Ryan shows how to avoid a CSS collision in Episode #264 @ about 10:17 when discussing how the ActiveAdmin CSS can cause a conflict with the normal CSS.
Removing from the application.css file:
*= require_tree .
and manually loading each of them in works much better.
Hi folks, what kind of naming convention do you propose for service objects?
I usually use nouns for class names. I used deverbal nouns for service names like 'ManagerInviter'. But in a review it was told to me to use verb as service names... like 'InviteManager'...
later versions of rails do not perform the search until you actually use the results. So every one of the calls in the code just builds a set of conditions.
it will not hit the database until you use "all" or "each" on "products"
I had this working perfectly following this screencast and then some weeks later I went back to check on it and it was borked. Now I'm getting this error whenever I hit the undo button:
Does anyone know if there's a way to get the Faye server (the one that Thin is used for) to actually log anything to console?
When I rackup the Faye server, I don't have the nice Rails-y output in the terminal - it just seems to hang (though it's definitely serving requests, just not saying anything about what it's doing in the background).
I had to change around_filter :scope_current_tenant to prepend_around_filter :scope_current_tenant to make sure the tenant was always loaded before my authorization before filter.
Can you be a bit more specific about where in the controller @user.avatar.reprocess! needs to go to fix the infinite loop problem? And will this fix work for Rails 4?
I love every video Ryan does. Even those I don't understand, which is quite a few ; ) I'm a noob.
Quick question. For the sprites functionality portion of this video, do I really need that if the Asset Pipeline is working to concatenate my assets? I presume the sprite images will already be made one request. Sorry if I'm completely missing the point of sprites.
Just a warning to anyone using page caching for more than HTML pages (e.g. JSON responses), the Rails will default to saving the cached file with the HTML extension, so requests hitting the cache will get the wrong format. To get around this, just append the format you're using in your request: curl railsapp.com/method.json. Rails will then save the file with the correct extension.
The tutorial is great, helped me alot, but I have some problems with one thing.
In the tutorial in the first moment RB say to make a first express checkout payment and right soon create the subscription, but this is very bad, because the whole transaction happen in two parts, and I've been in troubles when the first payment happend smoothly, but the subscription is not created for some error.
Hey everyone, so I am trying to use this on Rails 4 with Devise, is this not supported?
I get this error:
activemodel-4.0.0/lib/active_model/deprecated_mass_assignment_security.rb:14:in attr_accessible': attr_accessible is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add protected_attributes to your Gemfile to use old one. (RuntimeError)
Should I be using the "Protected Attributes" or having strong parameters defined in a controller somewhere, but which fields?
I had the same question, isn't the object_id already unique? Thank you for writing your comment, I didn't even have to write out the code to find out for myself.
Using Rails 4.0.1 Carrierwave_direct solution. Images get uploaded to S3 but I'm geting an errors in the background processing:
"error_message"=>"Validation failed: Image could not download file: 403 Forbidden", "error_class"=>"ActiveRecord::RecordInvalid"
2013-11-14T16:56:09Z 3924 TID-owk35rblw WARN: Validation failed: Image could not download file: 403 Forbidden
2013-11-14T16:56:09Z 3924 TID-owk35rblw WARN: /Users/Andris/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.1/lib/active_record/validations.rb:57:in `save!'
Hello all, Is there any demo application of implementing Riak database using Risky library in Rails application? I've googled alot but didn't find any. Even there is no episode in railscast for the same.
Hello all, Is there any demo application of implementing Riak database using Risky library in Rails application? I've googled alot but didn't find any. Even there is no episode in railscast for the same.
Agreed. For me, writing ng stuff on html template looks the same as writing Ruby code in erb. I'm okay with attributes and very simple logic such as "if" and iterator. But, no, thanks, no fancy stuff, no functions, I can't bare with them there.
If none of the solutions doesn't work. You can do a 'fix' by adding
'CREATE EXTENSION hstore'
in schema.rb file before any table is created and after running migrations.
After that you can call rake db:test:prepare and it will work.
Later you can just discard changes from schema.rb file.
You save my day. Thanks.
using Ruby 1.9.3 & Rails 3.2.14.
Does this work with optimistic locking and a lock_version column set up? I'm getting:
ActiveRecord::StaleObjectError
Problem is on line 4
Simple Form needs to submit the name of the zone, not the default
to_s
value. To do that, try the following in the form:In the model I only validate against US time zones in the following fashion:
I found that setting ipn within paypal settings on the account webpage it works.
Under My Account -> Profile
Then listed below select
Selling preferences -> Instant Payment Notification preferences
Set your callback address here and they'll ping though correctly.
Thanks a lot for the tutorial .. i am new to rails
can you please show me code of the partial used in the tutorial.
After implementing that authorization solution, many of my controllers specs started failing because they are not authorized to run without the proper permission. How can I fake permission in a controller test to fix this problem?
After implementing that authorization solution, many of my controllers specs started failing because they are not authorized to run without the proper permission. How can I fake permission in a controller test to fix this problem?
Great screencast as always! I run into a problem though. Can't make it work to add fields. After click on "add" the browser jumps to the top and no field is added. Remove field is working.
Anyone had the same issue, and figured it out?
http://stackoverflow.com/questions/20136241/nested-model-forms-railscast-196-revised-adding-fields-via-jquery-not-worki
Thanks!
I could be wrong, but remote links ( http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html) are probably what you'd want to use to implement this now, right?
I had the same issue however raising the timeout delay did not work for me. What I found though was the initial PJAX request was rendering the application layout, so I found this fix. In other words I added this:
I haven't figured out why the initial PJAX request was rendering my application layout, which is weird especially given that when I make PJAX requests to all my other pages the same behaviour does not occur.
Hope that helps someone though. :)
For anyone trying to implement this in Rails 4 don't forget to add {:category_ids => []} to params in the products_controller
And in that case you don't need a hidden field
<%= hidden_field_tag "#{f.object_name}[category_ids][]", nil %>
nor
params[:product][:category_ids] ||= []
Does anyone have a comment about the recent states of MetricFu and SimpleCov?
We created a gem at Continuum that provides a DSL on top of Roo for defining data importers. It's called active_importer and we think it could be useful for everyone. It's still a young project, and contributions are very much welcome.
Sonic is frustrated
I feel very frustrated after 2 weeks posting question at stack overflow, contacting people from this comment section and trying to figure out by myself how to resize images on the client side using Ryan Bate's method, unfortunately I couldn't solve, my project is 2 weeks late, and I'm very disappointed for not having the best solution explained here... Tha'ts my feedback from this screencast.
Ryan shows how to avoid a CSS collision in Episode #264 @ about 10:17 when discussing how the ActiveAdmin CSS can cause a conflict with the normal CSS.
Removing from the application.css file:
*= require_tree .
and manually loading each of them in works much better.
Hi folks, what kind of naming convention do you propose for service objects?
I usually use nouns for class names. I used deverbal nouns for service names like 'ManagerInviter'. But in a review it was told to me to use verb as service names... like 'InviteManager'...
Which one do you propose and why?
I second grammakov's request; plain javascript would be more helpful for me.
How would I build tests for the "find_products" method?
later versions of rails do not perform the search until you actually use the results. So every one of the calls in the code just builds a set of conditions.
it will not hit the database until you use "all" or "each" on "products"
This makes me confusing for a long time. Thanks for your explanation.
Hi here's the answer to my own question:
The latest versions of Papertrail actually namespace the Version class as PaperTrail::Version.
Problem solved.
I had this working perfectly following this screencast and then some weeks later I went back to check on it and it was borked. Now I'm getting this error whenever I hit the undo button:
uninitialized constant VersionsController::Version
I have it set up exactly as in this screencast, but I have no clue what might have broken it.
Problem is on line 3 apparently:
Any suggestions?
How can i perform step validation in the latest version 1.0.2 with rails 4. As
if: :on_categories_step?
is not working.Hey guys -
Does anyone know if there's a way to get the Faye server (the one that Thin is used for) to actually log anything to console?
When I rackup the Faye server, I don't have the nice Rails-y output in the terminal - it just seems to hang (though it's definitely serving requests, just not saying anything about what it's doing in the background).
Here's what I mean:
http://cl.ly/image/0r2f3S1Y3P1P
It'd be nice if I could specify something in the
faye.ru
file (some config option) that told Faye to expose verbose server logs.Thanks David, this was annoying me!
Any idea why it just crashes the server like that? Seems pretty flimsy to me but what do I know.
I had to change around_filter :scope_current_tenant to prepend_around_filter :scope_current_tenant to make sure the tenant was always loaded before my authorization before filter.
This was exactly the answer I came here looking for. Thank you so much, hopefully it works for me.
Can you be a bit more specific about where in the controller @user.avatar.reprocess! needs to go to fix the infinite loop problem? And will this fix work for Rails 4?
I love every video Ryan does. Even those I don't understand, which is quite a few ; ) I'm a noob.
Quick question. For the sprites functionality portion of this video, do I really need that if the Asset Pipeline is working to concatenate my assets? I presume the sprite images will already be made one request. Sorry if I'm completely missing the point of sprites.
Just a warning to anyone using page caching for more than HTML pages (e.g. JSON responses), the Rails will default to saving the cached file with the HTML extension, so requests hitting the cache will get the wrong format. To get around this, just append the format you're using in your request:
curl railsapp.com/method.json
. Rails will then save the file with the correct extension.The tutorial is great, helped me alot, but I have some problems with one thing.
In the tutorial in the first moment RB say to make a first express checkout payment and right soon create the subscription, but this is very bad, because the whole transaction happen in two parts, and I've been in troubles when the first payment happend smoothly, but the subscription is not created for some error.
Avoid this!
https://github.com/railscasts/289-paypal-recurring-billing/blob/master/saas-after/app/models/paypal_payment.rb#L15
Let the subscription make the first payment, case the subscription creation fails, the user won't make a first payment but no one subscription.
Hey everyone, so I am trying to use this on Rails 4 with Devise, is this not supported?
I get this error:
activemodel-4.0.0/lib/active_model/deprecated_mass_assignment_security.rb:14:in attr_accessible': attr_accessible is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add protected_attributes to your Gemfile to use old one. (RuntimeError)
Should I be using the "Protected Attributes" or having strong parameters defined in a controller somewhere, but which fields?
Thank you.
Did you figure this out? It is quite easy. If I am understanding what you are asking correctly, a simple change in the routes.rb file should do it.
I had the same question, isn't the
object_id
already unique? Thank you for writing your comment, I didn't even have to write out the code to find out for myself.Just did a little write-up which goes over how to add a repeating footer to your PDFs using Prawn - http://kyleke.es/posts/2013/11/creating-a-repeating-footer-w-prawn/
The devise github readme has a good explanation of how to handle strong parameters with devise in Rails 4.
If you are getting a 406 'unacceptable' when following the tutorial, then make this small change in your $resource in the coffeescript file:
"/entries/:id.json"
The .json makes it acceptable.
Hi @FlintMakal - how about this for nested resources instead?
When trying to debug, in ImageWorker method 'perform' product.image.direct_fog_url(with_path: true) is equal to:
"https://testbucket.s3.amazonaws.com/uploads/2b33ecda-2d3e-4962-b365-e55d07bae205/$%7Bfilename%7D"
I new in rails, i try to this work on rails 4, somebody had tried with this
Using Rails 4.0.1 Carrierwave_direct solution. Images get uploaded to S3 but I'm geting an errors in the background processing:
"error_message"=>"Validation failed: Image could not download file: 403 Forbidden", "error_class"=>"ActiveRecord::RecordInvalid"
2013-11-14T16:56:09Z 3924 TID-owk35rblw WARN: Validation failed: Image could not download file: 403 Forbidden
2013-11-14T16:56:09Z 3924 TID-owk35rblw WARN: /Users/Andris/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.1/lib/active_record/validations.rb:57:in `save!'
Hello all, Is there any demo application of implementing Riak database using Risky library in Rails application? I've googled alot but didn't find any. Even there is no episode in railscast for the same.
Hello all, Is there any demo application of implementing Riak database using Risky library in Rails application? I've googled alot but didn't find any. Even there is no episode in railscast for the same.
Agreed. For me, writing ng stuff on html template looks the same as writing Ruby code in erb. I'm okay with attributes and very simple logic such as "if" and iterator. But, no, thanks, no fancy stuff, no functions, I can't bare with them there.
ericeche,
Did you ever get a solution?
I get ERROR! THERE somebody can help me?
ExecJS::RuntimeError in Host_informations#index
Showing /Users/liucc/omm/app/views/layouts/application.html.erb where line #37 raised:
SyntaxError: unexpected TERMINATOR
(in /Users/liucc/omm/app/assets/javascripts/host_informations.js.coffee)
host_informations.js.coffee:
jQuery ->
Morris.Line
element: 'annual'
data: [
{y: '2012', a: 100}
{y: '2011', a: 75}
{y: '2010', a: 50}
{y: '2009', a: 75}
{y: '2008', a: 50}
{y: '2007', a: 75}
{y: '2006', a: 100}
]
xkey: 'y'
ykeys: ['a']
labels: ['Series a']
If none of the solutions doesn't work. You can do a 'fix' by adding
'CREATE EXTENSION hstore'
in schema.rb file before any table is created and after running migrations.
After that you can call rake db:test:prepare and it will work.
Later you can just discard changes from schema.rb file.
Same problem here, nothing gets populated. Have you figured it out?
thx!
me too... any ideas?