Has anyone been able to figure out the "Validation failed: Password can't be blank, Password is too short (minimum is 6 characters" error when hitting Reset Password Submission button.
Oh because I had to process the files on the server-side.
They are some source-code files, uploaded by users, which are fetched by the server for doing syntax highlighting. You are right, I should find some way to do the syntax highlighting only once and store that version on S3; and just give the link to the user.
I understand making gems Rails 4 ready is time-intensive, but most production apps I work on depend on gems that have yet to see some love. Nevertheless, we are starting the upgrade process and updating as dependencies are available.
Your cast makes the process very straightforward and manageable
Does anyone have any examples of using stripe in a nested form. For example I have a nested form that contains an affiliate which has_one subscription. This same affiliate also has a captcha. The problem is that that if i do something like
and there are errors with my affiliate model but not my subscription model, then the subscription gets saved without an affiliate_id, a customer is created by stripe and the same form re-renders populated with the stripe_token and the newly created subscription_id. Once the form is resubmitted and Affiliate.new(params[:affiliate] ) is called in the create action it is raising an error like Couldn't find Subscription with ID=31 for Affiliate with ID= since there is no affiliate_id in the subscription row in the DB. It would really be nice to see an example of this inside a nested form. Help!
I'd suggest fairly strongly getting a nice deep familiarity with SSH and how it works.
There's a lot you can do between that and some sage knowledge on the sudo command to write a fairly well locked down server that's ready to rock the world.
Combine this with knowledge on OpenBSD and how it works and you have a tank of a server that's going to be near impossible to break into.
But am a little unsure what to make of it. Was wondering if anyone else has come across this issue as it is pretty cool feature jquery upload. I am uploading video files and so being able to do it in batches means that their is less chance of file failure.
cache_digests is for generating md5 digests of your fragments and inserting them into the cachekey for the object you are caching, this is for caching in the model itself.
Great cast but I noticed we had to write many methods.
When I checked identity_cache gem, I have also to write fetch_xxx
Is there any gem cache by default everything without need to change my old code to use fetch_xxx?
I need a gem to use without changing my code and have to replace all finds with fetches.
try also find_cache gem https://github.com/mustafaturan/find_cache
- support for rails 3+ including rails 4
- catches your find_by attribute methods
- catches your belongs_to relation
- catches your has_one relations
- threading supported
dynamically expires cache when thread killed or with an after_filter on application controller
I have a semi unrelated question being a bit of a rails newbie. I notice all the Model functions being defined as self.function_name
I have seen this done both with self and without self and also with variables being defined both with and without self. What is the right way? They both seem to work.
If you are using the Dalli memcached gem, it is able to store binary data by using Rails.cache.fetch("foo", raw: true){Time.now}.
Btw, why do you want to cache it on server-side instead of delivering the S3 URL to the client? If the file is private, then you could use an authenticated URL with expiration
I'm going to attempt to answer my own question, it makes a little bit of sense after having written it down.
The Rails.cache.fetch call will attempt to return something for the key passed in, but it you also pass it a block it will execute the block and use the resulting value for that key if it wasn't already set.
And passing [article, "foo"] as the cache key is the same as passing:
articles/5-2013blahblahblahfoo
which is just a unique identifier in the cache. Slowly filtering through my dense head.
OK great. So a better example might have used something that would demonstrably change had the block been executed each time the fetch message was sent:
2:34 to 3:03. Those two sentences makes no sense to me whatsoever. I've listened to it 10 times, and I can't tell what that line does. Sometimes the "foobar" terminology is unhelpful.
"So, if we pass a model object to the fetch method it's going to automatically use the cache key for that object, and we can supply multiple keys in an array and they will be joined together. So let's say we have some kind of property we want to compute on that article, we can execute that in a block here and this block will be executed just once when it sets the key and the next time we trigger it it won't trigger the block because the key is already set unless we change the Article model and that will change the key value."
Here is the line Ryan is describing:
Rails.cache.fetch([article, "foo"]) { 123 }
which returns:
=> 123
then he types it in the console again, and the same thing happens. What does this line do again? And what does "123" do? And how do I know that it isn't triggered the second time?
How is any fetching done when nothing in the cache had been set yet? I am really missing something on this one.
I had a basic question. How can I cache static files that users have uploaded? I am using CarrierWave to upload the files which are hosted on S3, but every time I fetch them, it takes a very long time.
Hi,
I've downloaded the example code and I am unable to get the remove and add links to work. The remove check_box works fine. Since the same code works on my friends machine I believe the problem may be related to the way rails is configured on my computer. When I click the remove link a get the following http://localhost:3000/surveys/1/edit#
(note the # sign after the edit).
Can anyone suggest possible reasons for this?
Awesome screencast! Thanks for exposing this, and making it easy for me to ask a question (almost a year later) "Gee, I wonder if this was ever discussed on Railscasts?"
After pulling my hair out a bit with EmberData, I'm completely blown away by meteor...
What's the word on meteor support for other database technology? Like a SQL db?
Thanks for this episode. Ryan's statement about not separating test code and test data makes sense. How about shared factories across tests? Is that a bad idea?
However, when I ran this migration I got an undefined method 'hstore' error. I then went into my test database and created the hstore extension as you see below (rather than in the migration file as Ryan did)
psql rails4test2_development
psql (9.2.3)
Type "help" for help.
But I got the same error when I ran the migration.
undefined method hstore' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x007fa7ee7a9138>/Users/me/Sites/rails4test2/db/migrate/20130511204911_create_articles.rb:9:inblock in change'
/Users/me/Sites/rails4test2/db/migrate/20130511204911_create_articles.rb:4:in `change'
Can anyone help me understand why this isn't working for me?
from the line above the line you show, allow is either true or is a block or is nil. The line you show then checks that (1) allowed is not nil and either (2a) allowed is true or (2b) allowed is a block which returns true when passed resource (and resource must not be nil)
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
and i solve it using host: localhost in the database.yml
RAWK does not appear to work with recent versions of rails.
After some digging around, found this newer and maintained gem called request-log-analyzer, which does very similar work. And I love the output formats that it produces. Highly recommended https://github.com/wvanbergen/request-log-analyzer
Today I had some issues getting the progress bar to work as described by Ryan in this screencast. There seems to be an incompatibilty with jQuery 1.9 as Synthmax also mentioned.
In Firebug you'll see an this error when you try to upload a file:
Error: Syntax error, unrecognized expression:
I've found a solution to get the progress bar to work again.
Change the following line in your paintings.js.coffee:
data.context = $(tmpl("template-upload", file))
to:
data.context = $(tmpl("template-upload", file).trim()) if $('#template-upload').length > 0
Ryan,
Do you have any tips on how to test OmniAuth with RSpec/Capybara?
I'm trying Link without success.
Thanks,
Hi All,
Has anyone been able to figure out the "Validation failed: Password can't be blank, Password is too short (minimum is 6 characters" error when hitting Reset Password Submission button.
Please help???
Thanks in advance.
I got the link to Sublime working for Windows 7. Here are the instructions: https://gist.github.com/Vaselinessa/5584662
It's as simple as creating a registry key and creating a batch file.
Oh because I had to process the files on the server-side.
They are some source-code files, uploaded by users, which are fetched by the server for doing syntax highlighting. You are right, I should find some way to do the syntax highlighting only once and store that version on S3; and just give the link to the user.
Thanks so much for this, Ryan!
I understand making gems Rails 4 ready is time-intensive, but most production apps I work on depend on gems that have yet to see some love. Nevertheless, we are starting the upgrade process and updating as dependencies are available.
Your cast makes the process very straightforward and manageable
Thanks
Thank you John for the snippet! It was really helpful for me.
Rails has a method
.httpdate
, I think it's meant for this.Does anyone have any examples of using stripe in a nested form. For example I have a nested form that contains an affiliate which has_one subscription. This same affiliate also has a captcha. The problem is that that if i do something like
and there are errors with my affiliate model but not my subscription model, then the subscription gets saved without an affiliate_id, a customer is created by stripe and the same form re-renders populated with the stripe_token and the newly created subscription_id. Once the form is resubmitted and Affiliate.new(params[:affiliate] ) is called in the create action it is raising an error like
Couldn't find Subscription with ID=31 for Affiliate with ID=
since there is no affiliate_id in the subscription row in the DB. It would really be nice to see an example of this inside a nested form. Help!I'd suggest fairly strongly getting a nice deep familiarity with SSH and how it works.
There's a lot you can do between that and some sage knowledge on the sudo command to write a fairly well locked down server that's ready to rock the world.
Combine this with knowledge on OpenBSD and how it works and you have a tank of a server that's going to be near impossible to break into.
Recommended reading:
SSH Mastery: http://www.amazon.com/SSH-Mastery-OpenSSH-Tunnels-ebook/dp/B006ZO9ULK
Absolute OpenBSD: http://www.amazon.com/Absolute-OpenBSD-Practical-Paranoid-ebook/dp/B00CH96VB4/ref=sr_1_1?s=digital-text&ie=UTF8&qid=1368591922&sr=1-1&keywords=absolute+openbsd
Did you solve this issue?
Were you able to solve this?
File chunking.
maxChunkSize: 1000000
I am finding that this directive is working for me. However S3 is not merging the file back together at their end.
I am only getting the last chunked bit of the file appearing in the folder.
I have found this
http://aws.amazon.com/articles/1109?_encoding=UTF8&jiveRedirect=1#14
But am a little unsure what to make of it. Was wondering if anyone else has come across this issue as it is pretty cool feature jquery upload. I am uploading video files and so being able to do it in batches means that their is less chance of file failure.
Hope someone can shed some light.
Kind regards,
Luke
http://railscasts.com/episodes/368-miniprofiler
Miniprofiler
What tool do you use to see the number of queries done ? on the top left Windows ?
or in your case
Still not getting around having to wrap your code into a cache block, but check out:
https://github.com/cpuguy83/pack_rat
It just lets you call:
best $9 I've ever spent
cache_digests is for generating md5 digests of your fragments and inserting them into the cachekey for the object you are caching, this is for caching in the model itself.
I'm rather new to rails and javascript/coffee
could some1 please explain to me the logic behind this line:
data: $('statistics_chart').data('statistics')
what is the magic so to speak, behind the scenes?
I was looking for a good way to explain it, and found this. :)
def self.foo creates a class method.
"Class methods are methods that are called on a class and instance methods are methods that are called on an instance of a class."
via http://www.railstips.org/blog/archives/2009/05/11/class-and-instance-methods-in-ruby/
Great cast but I noticed we had to write many methods.
When I checked identity_cache gem, I have also to write fetch_xxx
Is there any gem cache by default everything without need to change my old code to use fetch_xxx?
I need a gem to use without changing my code and have to replace all finds with fetches.
I found some gems like
https://github.com/ngmoco/cache-mone --not working on Rails3--
https://github.com/orslumen/record-cache
https://github.com/csdn-dev/second_level_cache
Can anyone give suggestions/recommendations?
There is a typo in the ASCII cast:
rename title from: /app/views/templates/update.js.erb
to: /app/views/tasks/update.js.erb
try also find_cache gem https://github.com/mustafaturan/find_cache
- support for rails 3+ including rails 4
- catches your find_by attribute methods
- catches your belongs_to relation
- catches your has_one relations
- threading supported
dynamically expires cache when thread killed or with an after_filter on application controller
Another great cast.
I have a semi unrelated question being a bit of a rails newbie. I notice all the Model functions being defined as self.function_name
I have seen this done both with self and without self and also with variables being defined both with and without self. What is the right way? They both seem to work.
If you are using the Dalli memcached gem, it is able to store binary data by using
Rails.cache.fetch("foo", raw: true){Time.now}
.Btw, why do you want to cache it on server-side instead of delivering the S3 URL to the client? If the file is private, then you could use an authenticated URL with expiration
I'm going to attempt to answer my own question, it makes a little bit of sense after having written it down.
The Rails.cache.fetch call will attempt to return something for the key passed in, but it you also pass it a block it will execute the block and use the resulting value for that key if it wasn't already set.
And passing [article, "foo"] as the cache key is the same as passing:
which is just a unique identifier in the cache. Slowly filtering through my dense head.
OK great. So a better example might have used something that would demonstrably change had the block been executed each time the fetch message was sent:
wait 5 seconds, then:
Now I get it. ;-)
2:34 to 3:03. Those two sentences makes no sense to me whatsoever. I've listened to it 10 times, and I can't tell what that line does. Sometimes the "foobar" terminology is unhelpful.
"So, if we pass a model object to the fetch method it's going to automatically use the cache key for that object, and we can supply multiple keys in an array and they will be joined together. So let's say we have some kind of property we want to compute on that article, we can execute that in a block here and this block will be executed just once when it sets the key and the next time we trigger it it won't trigger the block because the key is already set unless we change the Article model and that will change the key value."
Here is the line Ryan is describing:
Rails.cache.fetch([article, "foo"]) { 123 }
which returns:
=> 123
then he types it in the console again, and the same thing happens. What does this line do again? And what does "123" do? And how do I know that it isn't triggered the second time?
How is any fetching done when nothing in the cache had been set yet? I am really missing something on this one.
When would you use this vs cache_digests?
Here's another gem with similar model caching functionality https://github.com/schneems/method_cacheable
Check out https://github.com/cpuguy83/pack_rat for some cache helpers in your model
Wow Hilarious :)
I had a basic question. How can I cache static files that users have uploaded? I am using CarrierWave to upload the files which are hosted on S3, but every time I fetch them, it takes a very long time.
Hi,
I've downloaded the example code and I am unable to get the remove and add links to work. The remove check_box works fine. Since the same code works on my friends machine I believe the problem may be related to the way rails is configured on my computer. When I click the remove link a get the following http://localhost:3000/surveys/1/edit#
(note the # sign after the edit).
Can anyone suggest possible reasons for this?
Sincerely,
Lisa
This was a lot of help for me: http://dansowter.com/mailman-guide/
remove in this order:
1. rails destroy simple_form:install
2. remove gem from Gemfile
3. bundle
Thanks Egbert! It worked for me!
This gem seems pretty dead now.
Awesome screencast! Thanks for exposing this, and making it easy for me to ask a question (almost a year later) "Gee, I wonder if this was ever discussed on Railscasts?"
After pulling my hair out a bit with EmberData, I'm completely blown away by meteor...
What's the word on meteor support for other database technology? Like a SQL db?
Just needed to add the version in my Gemfile
before:
gem "active_model_serializers"
after:
gem "active_model_serializers", "~> 0.8.0"
Thanks
For concurrent processing check Parallel gem also: https://github.com/grosser/parallel
+1
Thanks for this episode. Ryan's statement about not separating test code and test data makes sense. How about shared factories across tests? Is that a bad idea?
commented on <%= link_to activity.trackable.recipe.name, activity.trackable.recipe %>
For this code, How come I get error undefined method, I'm not using the exact names for my values, I'm doing it this way,
commented on <%= link_to activity.trackable.list.name, activity.trackable %>
but I'm not sure why I don't have to add a
.list
at the end of my code? Instead I can just stop at.trackable
I'm following along but getting some no
hstore
method erros when I run the migrationsrails g scaffold article name content:text published_on:date tags properties:hstore
and in the migration does this
execute "create extension hstore"
create_table :articles do |t|
t.string :name
t.text :content
t.date :published_on
t.string :tags, array: true
t.hstore :properties
t.timestamps
end
However, when I ran this migration I got an undefined method 'hstore' error. I then went into my test database and created the hstore extension as you see below (rather than in the migration file as Ryan did)
psql rails4test2_development
psql (9.2.3)
Type "help" for help.
rails4test2_development=# CREATE EXTENSION hstore;
But I got the same error when I ran the migration.
undefined method
hstore' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x007fa7ee7a9138>/Users/me/Sites/rails4test2/db/migrate/20130511204911_create_articles.rb:9:in
block in change'/Users/me/Sites/rails4test2/db/migrate/20130511204911_create_articles.rb:4:in `change'
Can anyone help me understand why this isn't working for me?
from the line above the line you show,
allow
is eithertrue
or is ablock
or isnil
. The line you show then checks that (1)allowed
is notnil
and either (2a)allowed
istrue
or (2b)allowed
is a block which returnstrue
when passedresource
(andresource
must not benil
)I suspect your test is so slow because of
page.should_not have_content
. Instead usepage.should have_no_content
The first one will wait and see if the content appears. The second will test straight away that there is no content.
i was getting this error
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
and i solve it using host: localhost in the database.yml
Thanks for making and maintaining this, Willem.
RAWK does not appear to work with recent versions of rails.
After some digging around, found this newer and maintained gem called request-log-analyzer, which does very similar work. And I love the output formats that it produces. Highly recommended https://github.com/wvanbergen/request-log-analyzer
Today I had some issues getting the progress bar to work as described by Ryan in this screencast. There seems to be an incompatibilty with jQuery 1.9 as Synthmax also mentioned.
In Firebug you'll see an this error when you try to upload a file:
Error: Syntax error, unrecognized expression:
I've found a solution to get the progress bar to work again.
Change the following line in your paintings.js.coffee:
data.context = $(tmpl("template-upload", file))
to:
data.context = $(tmpl("template-upload", file).trim()) if $('#template-upload').length > 0
Please let me know if this helps you